@babylonjs/smart-filters 0.7.10-alpha → 0.7.12-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/dist/blockFoundation/outputBlock.d.ts +5 -0
  2. package/dist/blockFoundation/outputBlock.d.ts.map +1 -1
  3. package/dist/blockFoundation/outputBlock.js +30 -1
  4. package/dist/blockFoundation/outputBlock.js.map +1 -1
  5. package/dist/index.d.ts +0 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +0 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/version.d.ts +1 -1
  10. package/dist/version.js +1 -1
  11. package/package.json +5 -10
  12. package/readme.md +2 -0
  13. package/src/blockFoundation/outputBlock.ts +33 -1
  14. package/src/index.ts +0 -2
  15. package/src/version.ts +1 -1
  16. package/dist/blockFoundation/outputBlock.shader.d.ts +0 -13
  17. package/dist/blockFoundation/outputBlock.shader.d.ts.map +0 -1
  18. package/dist/blockFoundation/outputBlock.shader.js +0 -31
  19. package/dist/blockFoundation/outputBlock.shader.js.map +0 -1
  20. package/dist/blockRegistration/IBlockRegistration.d.ts +0 -36
  21. package/dist/blockRegistration/IBlockRegistration.d.ts.map +0 -1
  22. package/dist/blockRegistration/IBlockRegistration.js +0 -2
  23. package/dist/blockRegistration/IBlockRegistration.js.map +0 -1
  24. package/dist/blockRegistration/blockSerializers.d.ts +0 -13
  25. package/dist/blockRegistration/blockSerializers.d.ts.map +0 -1
  26. package/dist/blockRegistration/blockSerializers.js +0 -35
  27. package/dist/blockRegistration/blockSerializers.js.map +0 -1
  28. package/dist/blockRegistration/builtInBlockRegistrations.d.ts +0 -13
  29. package/dist/blockRegistration/builtInBlockRegistrations.d.ts.map +0 -1
  30. package/dist/blockRegistration/builtInBlockRegistrations.js +0 -266
  31. package/dist/blockRegistration/builtInBlockRegistrations.js.map +0 -1
  32. package/dist/blockRegistration/index.d.ts +0 -3
  33. package/dist/blockRegistration/index.d.ts.map +0 -1
  34. package/dist/blockRegistration/index.js +0 -3
  35. package/dist/blockRegistration/index.js.map +0 -1
  36. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.d.ts +0 -56
  37. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.d.ts.map +0 -1
  38. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.js +0 -66
  39. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.js.map +0 -1
  40. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.shader.d.ts +0 -13
  41. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.shader.d.ts.map +0 -1
  42. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.shader.js +0 -36
  43. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.shader.js.map +0 -1
  44. package/dist/blocks/babylon/demo/effects/blurBlock.d.ts +0 -56
  45. package/dist/blocks/babylon/demo/effects/blurBlock.d.ts.map +0 -1
  46. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.d.ts +0 -29
  47. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.d.ts.map +0 -1
  48. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.js +0 -16
  49. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.js.map +0 -1
  50. package/dist/blocks/babylon/demo/effects/blurBlock.js +0 -100
  51. package/dist/blocks/babylon/demo/effects/blurBlock.js.map +0 -1
  52. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.d.ts +0 -8
  53. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.d.ts.map +0 -1
  54. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.js +0 -28
  55. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.js.map +0 -1
  56. package/dist/blocks/babylon/demo/effects/compositionBlock.d.ts +0 -118
  57. package/dist/blocks/babylon/demo/effects/compositionBlock.d.ts.map +0 -1
  58. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.d.ts +0 -25
  59. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.d.ts.map +0 -1
  60. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.js +0 -15
  61. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.js.map +0 -1
  62. package/dist/blocks/babylon/demo/effects/compositionBlock.js +0 -219
  63. package/dist/blocks/babylon/demo/effects/compositionBlock.js.map +0 -1
  64. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.d.ts +0 -6
  65. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.d.ts.map +0 -1
  66. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.js +0 -25
  67. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.js.map +0 -1
  68. package/dist/blocks/babylon/demo/effects/contrastBlock.d.ts +0 -63
  69. package/dist/blocks/babylon/demo/effects/contrastBlock.d.ts.map +0 -1
  70. package/dist/blocks/babylon/demo/effects/contrastBlock.js +0 -122
  71. package/dist/blocks/babylon/demo/effects/contrastBlock.js.map +0 -1
  72. package/dist/blocks/babylon/demo/effects/desaturateBlock.d.ts +0 -63
  73. package/dist/blocks/babylon/demo/effects/desaturateBlock.d.ts.map +0 -1
  74. package/dist/blocks/babylon/demo/effects/desaturateBlock.js +0 -107
  75. package/dist/blocks/babylon/demo/effects/desaturateBlock.js.map +0 -1
  76. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.d.ts +0 -79
  77. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.d.ts.map +0 -1
  78. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.d.ts +0 -33
  79. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.d.ts.map +0 -1
  80. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.js +0 -17
  81. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.js.map +0 -1
  82. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.js +0 -171
  83. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.js.map +0 -1
  84. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.d.ts +0 -6
  85. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.d.ts.map +0 -1
  86. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.js +0 -27
  87. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.js.map +0 -1
  88. package/dist/blocks/babylon/demo/effects/exposureBlock.d.ts +0 -63
  89. package/dist/blocks/babylon/demo/effects/exposureBlock.d.ts.map +0 -1
  90. package/dist/blocks/babylon/demo/effects/exposureBlock.js +0 -95
  91. package/dist/blocks/babylon/demo/effects/exposureBlock.js.map +0 -1
  92. package/dist/blocks/babylon/demo/effects/greenScreenBlock.d.ts +0 -75
  93. package/dist/blocks/babylon/demo/effects/greenScreenBlock.d.ts.map +0 -1
  94. package/dist/blocks/babylon/demo/effects/greenScreenBlock.js +0 -121
  95. package/dist/blocks/babylon/demo/effects/greenScreenBlock.js.map +0 -1
  96. package/dist/blocks/babylon/demo/effects/index.d.ts +0 -15
  97. package/dist/blocks/babylon/demo/effects/index.d.ts.map +0 -1
  98. package/dist/blocks/babylon/demo/effects/index.js +0 -15
  99. package/dist/blocks/babylon/demo/effects/index.js.map +0 -1
  100. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.d.ts +0 -63
  101. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.d.ts.map +0 -1
  102. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.js +0 -159
  103. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.js.map +0 -1
  104. package/dist/blocks/babylon/demo/effects/maskBlock.d.ts +0 -62
  105. package/dist/blocks/babylon/demo/effects/maskBlock.d.ts.map +0 -1
  106. package/dist/blocks/babylon/demo/effects/maskBlock.js +0 -75
  107. package/dist/blocks/babylon/demo/effects/maskBlock.js.map +0 -1
  108. package/dist/blocks/babylon/demo/effects/maskBlock.shader.d.ts +0 -14
  109. package/dist/blocks/babylon/demo/effects/maskBlock.shader.d.ts.map +0 -1
  110. package/dist/blocks/babylon/demo/effects/maskBlock.shader.js +0 -37
  111. package/dist/blocks/babylon/demo/effects/maskBlock.shader.js.map +0 -1
  112. package/dist/blocks/babylon/demo/effects/pixelateBlock.d.ts +0 -62
  113. package/dist/blocks/babylon/demo/effects/pixelateBlock.d.ts.map +0 -1
  114. package/dist/blocks/babylon/demo/effects/pixelateBlock.js +0 -77
  115. package/dist/blocks/babylon/demo/effects/pixelateBlock.js.map +0 -1
  116. package/dist/blocks/babylon/demo/effects/pixelateBlock.shader.d.ts +0 -15
  117. package/dist/blocks/babylon/demo/effects/pixelateBlock.shader.d.ts.map +0 -1
  118. package/dist/blocks/babylon/demo/effects/pixelateBlock.shader.js +0 -44
  119. package/dist/blocks/babylon/demo/effects/pixelateBlock.shader.js.map +0 -1
  120. package/dist/blocks/babylon/demo/effects/posterizeBlock.d.ts +0 -63
  121. package/dist/blocks/babylon/demo/effects/posterizeBlock.d.ts.map +0 -1
  122. package/dist/blocks/babylon/demo/effects/posterizeBlock.js +0 -108
  123. package/dist/blocks/babylon/demo/effects/posterizeBlock.js.map +0 -1
  124. package/dist/blocks/babylon/demo/effects/spritesheetBlock.d.ts +0 -81
  125. package/dist/blocks/babylon/demo/effects/spritesheetBlock.d.ts.map +0 -1
  126. package/dist/blocks/babylon/demo/effects/spritesheetBlock.js +0 -103
  127. package/dist/blocks/babylon/demo/effects/spritesheetBlock.js.map +0 -1
  128. package/dist/blocks/babylon/demo/effects/spritesheetBlock.shader.d.ts +0 -18
  129. package/dist/blocks/babylon/demo/effects/spritesheetBlock.shader.d.ts.map +0 -1
  130. package/dist/blocks/babylon/demo/effects/spritesheetBlock.shader.js +0 -57
  131. package/dist/blocks/babylon/demo/effects/spritesheetBlock.shader.js.map +0 -1
  132. package/dist/blocks/babylon/demo/effects/tintBlock.d.ts +0 -7
  133. package/dist/blocks/babylon/demo/effects/tintBlock.d.ts.map +0 -1
  134. package/dist/blocks/babylon/demo/effects/tintBlock.js +0 -51
  135. package/dist/blocks/babylon/demo/effects/tintBlock.js.map +0 -1
  136. package/dist/blocks/babylon/demo/transitions/index.d.ts +0 -2
  137. package/dist/blocks/babylon/demo/transitions/index.d.ts.map +0 -1
  138. package/dist/blocks/babylon/demo/transitions/index.js +0 -2
  139. package/dist/blocks/babylon/demo/transitions/index.js.map +0 -1
  140. package/dist/blocks/babylon/demo/transitions/wipeBlock.d.ts +0 -69
  141. package/dist/blocks/babylon/demo/transitions/wipeBlock.d.ts.map +0 -1
  142. package/dist/blocks/babylon/demo/transitions/wipeBlock.js +0 -110
  143. package/dist/blocks/babylon/demo/transitions/wipeBlock.js.map +0 -1
  144. package/dist/blocks/babylon/demo/utilities/index.d.ts +0 -2
  145. package/dist/blocks/babylon/demo/utilities/index.d.ts.map +0 -1
  146. package/dist/blocks/babylon/demo/utilities/index.js +0 -2
  147. package/dist/blocks/babylon/demo/utilities/index.js.map +0 -1
  148. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.d.ts +0 -58
  149. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.d.ts.map +0 -1
  150. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.js +0 -87
  151. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.js.map +0 -1
  152. package/dist/blocks/blockNamespaces.d.ts +0 -5
  153. package/dist/blocks/blockNamespaces.d.ts.map +0 -1
  154. package/dist/blocks/blockNamespaces.js +0 -5
  155. package/dist/blocks/blockNamespaces.js.map +0 -1
  156. package/dist/blocks/blockTypes.d.ts +0 -22
  157. package/dist/blocks/blockTypes.d.ts.map +0 -1
  158. package/dist/blocks/blockTypes.js +0 -22
  159. package/dist/blocks/blockTypes.js.map +0 -1
  160. package/dist/blocks/index.d.ts +0 -6
  161. package/dist/blocks/index.d.ts.map +0 -1
  162. package/dist/blocks/index.js +0 -6
  163. package/dist/blocks/index.js.map +0 -1
  164. package/src/blockFoundation/outputBlock.fragment.glsl +0 -5
  165. package/src/blockFoundation/outputBlock.shader.ts +0 -33
  166. package/src/blockRegistration/IBlockRegistration.ts +0 -45
  167. package/src/blockRegistration/blockSerializers.ts +0 -52
  168. package/src/blockRegistration/builtInBlockRegistrations.ts +0 -390
  169. package/src/blockRegistration/index.ts +0 -2
  170. package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.fragment.glsl +0 -10
  171. package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.shader.ts +0 -38
  172. package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.ts +0 -80
  173. package/src/blocks/babylon/demo/effects/blurBlock.deserializer.ts +0 -38
  174. package/src/blocks/babylon/demo/effects/blurBlock.serializer.ts +0 -32
  175. package/src/blocks/babylon/demo/effects/blurBlock.ts +0 -119
  176. package/src/blocks/babylon/demo/effects/compositionBlock.deserializer.ts +0 -32
  177. package/src/blocks/babylon/demo/effects/compositionBlock.serializer.ts +0 -29
  178. package/src/blocks/babylon/demo/effects/compositionBlock.ts +0 -293
  179. package/src/blocks/babylon/demo/effects/contrastBlock.ts +0 -152
  180. package/src/blocks/babylon/demo/effects/desaturateBlock.ts +0 -137
  181. package/src/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.ts +0 -47
  182. package/src/blocks/babylon/demo/effects/directionalBlurBlock.serializer.ts +0 -31
  183. package/src/blocks/babylon/demo/effects/directionalBlurBlock.ts +0 -193
  184. package/src/blocks/babylon/demo/effects/exposureBlock.ts +0 -120
  185. package/src/blocks/babylon/demo/effects/greenScreenBlock.ts +0 -152
  186. package/src/blocks/babylon/demo/effects/index.ts +0 -14
  187. package/src/blocks/babylon/demo/effects/kaleidoscopeBlock.ts +0 -186
  188. package/src/blocks/babylon/demo/effects/maskBlock.fragment.glsl +0 -10
  189. package/src/blocks/babylon/demo/effects/maskBlock.shader.ts +0 -39
  190. package/src/blocks/babylon/demo/effects/maskBlock.ts +0 -94
  191. package/src/blocks/babylon/demo/effects/pixelateBlock.fragment.glsl +0 -18
  192. package/src/blocks/babylon/demo/effects/pixelateBlock.shader.ts +0 -46
  193. package/src/blocks/babylon/demo/effects/pixelateBlock.ts +0 -101
  194. package/src/blocks/babylon/demo/effects/posterizeBlock.ts +0 -139
  195. package/src/blocks/babylon/demo/effects/spritesheetBlock.fragment.glsl +0 -26
  196. package/src/blocks/babylon/demo/effects/spritesheetBlock.shader.ts +0 -59
  197. package/src/blocks/babylon/demo/effects/spritesheetBlock.ts +0 -135
  198. package/src/blocks/babylon/demo/effects/tintBlock.ts +0 -52
  199. package/src/blocks/babylon/demo/transitions/index.ts +0 -1
  200. package/src/blocks/babylon/demo/transitions/wipeBlock.ts +0 -138
  201. package/src/blocks/babylon/demo/utilities/index.ts +0 -1
  202. package/src/blocks/babylon/demo/utilities/premultiplyAlphaBlock.ts +0 -106
  203. package/src/blocks/blockNamespaces.ts +0 -4
  204. package/src/blocks/blockTypes.ts +0 -21
  205. package/src/blocks/index.ts +0 -5
@@ -1,390 +0,0 @@
1
- import type { ThinEngine } from "@babylonjs/core/Engines/thinEngine.js";
2
- import type { IBlockRegistration } from "./IBlockRegistration.js";
3
- import {
4
- babylonDemoEffectsNamespace,
5
- babylonDemoTransitionsNamespace,
6
- babylonDemoUtilitiesNamespace,
7
- inputsNamespace,
8
- } from "../blocks/blockNamespaces.js";
9
- import { CustomShaderBlock } from "../blockFoundation/customShaderBlock.js";
10
- import {
11
- blackAndWhiteBlockType,
12
- kaleidoscopeBlockType,
13
- posterizeBlockType,
14
- desaturateBlockType,
15
- contrastBlockType,
16
- greenScreenBlockType,
17
- pixelateBlockType,
18
- exposureBlockType,
19
- maskBlockType,
20
- spritesheetBlockType,
21
- premultiplyAlphaBlockType,
22
- wipeBlockType,
23
- blurBlockType,
24
- compositionBlockType,
25
- tintBlockType,
26
- } from "../blocks/blockTypes.js";
27
- import { ConnectionPointType } from "../connection/connectionPointType.js";
28
- import type { ISerializedBlockV1 } from "../serialization/index.js";
29
- import type { SmartFilterDeserializer } from "../serialization/smartFilterDeserializer.js";
30
- import type { SmartFilter } from "../smartFilter.js";
31
- import { InputBlock } from "../blockFoundation/inputBlock.js";
32
-
33
- /**
34
- * The list of block registrations.
35
- *
36
- * Important notes:
37
- * 1. Do not import the block code directly in this file. Instead, use dynamic imports to ensure that the block code
38
- * is only loaded when needed.
39
- * 2. If the deserializer is trivial (doesn't require consulting the serializedBlock.data), it can be implemented here
40
- * 3. If the deserializer is non-trivial (needs serializedBlock.data), implement it in a separate file alongside the block
41
- * in the form blockClassName.deserializer.ts
42
- */
43
- export const builtInBlockRegistrations: IBlockRegistration[] = [
44
- // Blocks with trivial deserializers
45
- // Note that some choose to predefine corresponding input blocks if not being deserialized
46
- // ---------------------------------------------------------------------------------------
47
- {
48
- blockType: blackAndWhiteBlockType,
49
- factory: async (
50
- smartFilter: SmartFilter,
51
- _engine: ThinEngine,
52
- _smartFilterDeserializer: SmartFilterDeserializer,
53
- serializedBlock: ISerializedBlockV1 | undefined
54
- ) => {
55
- const module = await import(
56
- /* webpackChunkName: "blackAndWhiteBlock" */ "../blocks/babylon/demo/effects/blackAndWhiteBlock.js"
57
- );
58
- return new module.BlackAndWhiteBlock(smartFilter, serializedBlock?.name || "BlackAndWhite");
59
- },
60
- namespace: babylonDemoEffectsNamespace,
61
- tooltip: "Transform the input texture to black and white",
62
- },
63
- {
64
- blockType: kaleidoscopeBlockType,
65
- factory: async (
66
- smartFilter: SmartFilter,
67
- _engine: ThinEngine,
68
- _smartFilterDeserializer: SmartFilterDeserializer,
69
- serializedBlock: ISerializedBlockV1 | undefined
70
- ) => {
71
- const module = await import(
72
- /* webpackChunkName: "kaleidoscopeBlock" */ "../blocks/babylon/demo/effects/kaleidoscopeBlock.js"
73
- );
74
- const block = new module.KaleidoscopeBlock(smartFilter, serializedBlock?.name || "Kaleidoscope");
75
- if (!serializedBlock) {
76
- const input = new InputBlock(smartFilter, "Angle", ConnectionPointType.Float, 0);
77
- input.output.connectTo(block.time);
78
- }
79
- return block;
80
- },
81
- namespace: babylonDemoEffectsNamespace,
82
- tooltip: "Kaleidoscope effect",
83
- },
84
- {
85
- blockType: posterizeBlockType,
86
- factory: async (
87
- smartFilter: SmartFilter,
88
- _engine: ThinEngine,
89
- _smartFilterDeserializer: SmartFilterDeserializer,
90
- serializedBlock: ISerializedBlockV1 | undefined
91
- ) => {
92
- const module = await import(
93
- /* webpackChunkName: "posterizeBlock" */ "../blocks/babylon/demo/effects/posterizeBlock.js"
94
- );
95
- const block = new module.PosterizeBlock(smartFilter, serializedBlock?.name || "Posterize");
96
- if (!serializedBlock) {
97
- const input = new InputBlock(smartFilter, "Intensity", ConnectionPointType.Float, 0.5);
98
- input.output.connectTo(block.intensity);
99
- }
100
- return block;
101
- },
102
- namespace: babylonDemoEffectsNamespace,
103
- tooltip: "Posterize to the input texture",
104
- },
105
- {
106
- blockType: desaturateBlockType,
107
- factory: async (
108
- smartFilter: SmartFilter,
109
- _engine: ThinEngine,
110
- _smartFilterDeserializer: SmartFilterDeserializer,
111
- serializedBlock: ISerializedBlockV1 | undefined
112
- ) => {
113
- const module = await import(
114
- /* webpackChunkName: "desaturateBlock" */ "../blocks/babylon/demo/effects/desaturateBlock.js"
115
- );
116
- const block = new module.DesaturateBlock(smartFilter, serializedBlock?.name || "Desaturate");
117
- if (!serializedBlock) {
118
- const input = new InputBlock(smartFilter, "Intensity", ConnectionPointType.Float, 0.5);
119
- input.output.connectTo(block.intensity);
120
- }
121
- return block;
122
- },
123
- namespace: babylonDemoEffectsNamespace,
124
- tooltip: "Applies a desaturated effect to the input texture",
125
- },
126
- {
127
- blockType: contrastBlockType,
128
- factory: async (
129
- smartFilter: SmartFilter,
130
- _engine: ThinEngine,
131
- _smartFilterDeserializer: SmartFilterDeserializer,
132
- serializedBlock: ISerializedBlockV1 | undefined
133
- ) => {
134
- const module = await import(
135
- /* webpackChunkName: "contrastBlock" */ "../blocks/babylon/demo/effects/contrastBlock.js"
136
- );
137
- const block = new module.ContrastBlock(smartFilter, serializedBlock?.name || "Contrast");
138
- if (!serializedBlock) {
139
- const input = new InputBlock(smartFilter, "Intensity", ConnectionPointType.Float, 0.5);
140
- input.output.connectTo(block.intensity);
141
- }
142
- return block;
143
- },
144
- namespace: babylonDemoEffectsNamespace,
145
- tooltip: "Change the contrast of the input texture",
146
- },
147
- {
148
- blockType: greenScreenBlockType,
149
- factory: async (
150
- smartFilter: SmartFilter,
151
- _engine: ThinEngine,
152
- _smartFilterDeserializer: SmartFilterDeserializer,
153
- serializedBlock: ISerializedBlockV1 | undefined
154
- ) => {
155
- const module = await import(
156
- /* webpackChunkName: "greenScreenBlock" */ "../blocks/babylon/demo/effects/greenScreenBlock.js"
157
- );
158
- const block = new module.GreenScreenBlock(smartFilter, serializedBlock?.name || "GreenScreen");
159
- if (!serializedBlock) {
160
- const reference = new InputBlock(smartFilter, "Reference", ConnectionPointType.Color3, {
161
- r: 92 / 255,
162
- g: 204 / 255,
163
- b: 78 / 255,
164
- });
165
- const distance = new InputBlock(smartFilter, "Distance", ConnectionPointType.Float, 0.25);
166
- reference.output.connectTo(block.reference);
167
- distance.output.connectTo(block.distance);
168
- }
169
- return block;
170
- },
171
- namespace: babylonDemoEffectsNamespace,
172
- tooltip: "Replaces a green screen background with a different texture",
173
- },
174
- {
175
- blockType: pixelateBlockType,
176
- factory: async (
177
- smartFilter: SmartFilter,
178
- _engine: ThinEngine,
179
- _smartFilterDeserializer: SmartFilterDeserializer,
180
- serializedBlock: ISerializedBlockV1 | undefined
181
- ) => {
182
- const module = await import(
183
- /* webpackChunkName: "pixelateBlock" */ "../blocks/babylon/demo/effects/pixelateBlock.js"
184
- );
185
- const block = new module.PixelateBlock(smartFilter, serializedBlock?.name || "Pixelate");
186
- if (!serializedBlock) {
187
- const input = new InputBlock(smartFilter, "Intensity", ConnectionPointType.Float, 0.4);
188
- input.output.connectTo(block.intensity);
189
- }
190
- return block;
191
- },
192
- namespace: babylonDemoEffectsNamespace,
193
- tooltip: "Add pixelation to the input texture",
194
- },
195
- {
196
- blockType: exposureBlockType,
197
- factory: async (
198
- smartFilter: SmartFilter,
199
- _engine: ThinEngine,
200
- _smartFilterDeserializer: SmartFilterDeserializer,
201
- serializedBlock: ISerializedBlockV1 | undefined
202
- ) => {
203
- const module = await import(
204
- /* webpackChunkName: "exposureBlock" */ "../blocks/babylon/demo/effects/exposureBlock.js"
205
- );
206
- const block = new module.ExposureBlock(smartFilter, serializedBlock?.name || "Exposure");
207
- if (!serializedBlock) {
208
- const input = new InputBlock(smartFilter, "Amount", ConnectionPointType.Float, 0.7);
209
- input.output.connectTo(block.amount);
210
- }
211
- return block;
212
- },
213
- namespace: babylonDemoEffectsNamespace,
214
- tooltip: "Alters the exposure of the input texture",
215
- },
216
- {
217
- blockType: maskBlockType,
218
- factory: async (
219
- smartFilter: SmartFilter,
220
- _engine: ThinEngine,
221
- _smartFilterDeserializer: SmartFilterDeserializer,
222
- serializedBlock: ISerializedBlockV1 | undefined
223
- ) => {
224
- const module = await import(
225
- /* webpackChunkName: "maskBlock" */ "../blocks/babylon/demo/effects/maskBlock.js"
226
- );
227
- return new module.MaskBlock(smartFilter, serializedBlock?.name || "Mask");
228
- },
229
- namespace: babylonDemoEffectsNamespace,
230
- tooltip: "Applies mask in one texture to another texture",
231
- },
232
- {
233
- blockType: spritesheetBlockType,
234
- factory: async (
235
- smartFilter: SmartFilter,
236
- _engine: ThinEngine,
237
- _smartFilterDeserializer: SmartFilterDeserializer,
238
- serializedBlock: ISerializedBlockV1 | undefined
239
- ) => {
240
- const module = await import(
241
- /* webpackChunkName: "spritesheetBlock" */ "../blocks/babylon/demo/effects/spritesheetBlock.js"
242
- );
243
- return new module.SpritesheetBlock(smartFilter, serializedBlock?.name || "Spritesheet");
244
- },
245
- namespace: babylonDemoEffectsNamespace,
246
- tooltip: "Animates a sprite sheet texture",
247
- },
248
- {
249
- blockType: premultiplyAlphaBlockType,
250
- factory: async (
251
- smartFilter: SmartFilter,
252
- _engine: ThinEngine,
253
- _smartFilterDeserializer: SmartFilterDeserializer,
254
- serializedBlock: ISerializedBlockV1 | undefined
255
- ) => {
256
- const module = await import(
257
- /* webpackChunkName: "premultiplyAlphaBlock" */ "../blocks/babylon/demo/utilities/premultiplyAlphaBlock.js"
258
- );
259
- return new module.PremultiplyAlphaBlock(smartFilter, serializedBlock?.name || "PremultiplyAlpha");
260
- },
261
- namespace: babylonDemoUtilitiesNamespace,
262
- tooltip: "Premultiplies the input texture's color against its alpha",
263
- },
264
- {
265
- blockType: wipeBlockType,
266
- factory: async (
267
- smartFilter: SmartFilter,
268
- _engine: ThinEngine,
269
- _smartFilterDeserializer: SmartFilterDeserializer,
270
- serializedBlock: ISerializedBlockV1 | undefined
271
- ) => {
272
- const module = await import(
273
- /* webpackChunkName: "wipeBlock" */ "../blocks/babylon/demo/transitions/wipeBlock.js"
274
- );
275
- return new module.WipeBlock(smartFilter, serializedBlock?.name || "Wipe");
276
- },
277
- namespace: babylonDemoTransitionsNamespace,
278
- tooltip: "Transition from one texture to another using a wipe",
279
- },
280
-
281
- // Blocks with custom deserializers
282
- // --------------------------------
283
- {
284
- blockType: blurBlockType,
285
- factory: async (
286
- smartFilter: SmartFilter,
287
- _engine: ThinEngine,
288
- _smartFilterDeserializer: SmartFilterDeserializer,
289
- serializedBlock: ISerializedBlockV1 | undefined
290
- ) => {
291
- if (serializedBlock) {
292
- const module = await import(
293
- /* webpackChunkName: "blurBlockDeserializer" */ "../blocks/babylon/demo/effects/blurBlock.deserializer.js"
294
- );
295
- return module.blurBlockDeserializer(smartFilter, serializedBlock);
296
- } else {
297
- const module = await import(
298
- /* webpackChunkName: "blurBlock" */ "../blocks/babylon/demo/effects/blurBlock.js"
299
- );
300
- return new module.BlurBlock(smartFilter, "Blur");
301
- }
302
- },
303
- namespace: babylonDemoEffectsNamespace,
304
- tooltip: "Blur the input texture",
305
- },
306
- {
307
- blockType: compositionBlockType,
308
- factory: async (
309
- smartFilter: SmartFilter,
310
- _engine: ThinEngine,
311
- _smartFilterDeserializer: SmartFilterDeserializer,
312
- serializedBlock: ISerializedBlockV1 | undefined
313
- ) => {
314
- if (serializedBlock) {
315
- const module = await import(
316
- /* webpackChunkName: "compositionBlockDeserializer" */ "../blocks/babylon/demo/effects/compositionBlock.deserializer.js"
317
- );
318
- return module.compositionDeserializer(smartFilter, serializedBlock);
319
- } else {
320
- const module = await import(
321
- /* webpackChunkName: "compositionBlock" */ "../blocks/babylon/demo/effects/compositionBlock.js"
322
- );
323
- const block = new module.CompositionBlock(smartFilter, "Composition");
324
- const top = new InputBlock(smartFilter, "Top", ConnectionPointType.Float, 0.0);
325
- const left = new InputBlock(smartFilter, "Left", ConnectionPointType.Float, 0.0);
326
- const width = new InputBlock(smartFilter, "Width", ConnectionPointType.Float, 1.0);
327
- const height = new InputBlock(smartFilter, "Height", ConnectionPointType.Float, 1.0);
328
-
329
- top.output.connectTo(block.foregroundTop);
330
- left.output.connectTo(block.foregroundLeft);
331
- width.output.connectTo(block.foregroundWidth);
332
- height.output.connectTo(block.foregroundHeight);
333
- return block;
334
- }
335
- },
336
- namespace: babylonDemoEffectsNamespace,
337
- tooltip: "Composite the foreground texture over the background texture",
338
- },
339
-
340
- // Blocks defined by serialized definitions
341
- // ----------------------------------------
342
- {
343
- blockType: tintBlockType,
344
- factory: async (
345
- smartFilter: SmartFilter,
346
- _engine: ThinEngine,
347
- _smartFilterDeserializer: SmartFilterDeserializer,
348
- serializedBlock: ISerializedBlockV1 | undefined
349
- ) => {
350
- const module = await import(
351
- /* webpackChunkName: "tintBlock" */ "../blocks/babylon/demo/effects/tintBlock.js"
352
- );
353
- return CustomShaderBlock.Create(
354
- smartFilter,
355
- serializedBlock?.name || "Tint",
356
- module.deserializedTintBlockDefinition
357
- );
358
- },
359
- namespace: babylonDemoEffectsNamespace,
360
- tooltip: "Adds colored tint to the input texture",
361
- },
362
-
363
- // Standard input blocks
364
- // ---------------------
365
- {
366
- blockType: "Float",
367
- namespace: inputsNamespace,
368
- tooltip: "A floating point number representing a value with a fractional component",
369
- },
370
- {
371
- blockType: "Color3",
372
- namespace: inputsNamespace,
373
- tooltip: "A set of 3 floating point numbers representing a color",
374
- },
375
- {
376
- blockType: "Color4",
377
- namespace: inputsNamespace,
378
- tooltip: "A set of 4 floating point numbers representing a color",
379
- },
380
- {
381
- blockType: "Texture",
382
- namespace: inputsNamespace,
383
- tooltip: "A texture to be used as input",
384
- },
385
- {
386
- blockType: "Vector2",
387
- namespace: inputsNamespace,
388
- tooltip: "A Vector2 to be used as input",
389
- },
390
- ];
@@ -1,2 +0,0 @@
1
- export * from "./builtInBlockRegistrations.js";
2
- export * from "./IBlockRegistration.js";
@@ -1,10 +0,0 @@
1
- uniform sampler2D input; // main
2
-
3
- vec4 blackAndWhite(vec2 vUV) { // main
4
- vec4 color = texture2D(input, vUV);
5
-
6
- float luminance = dot(color.rgb, vec3(0.3, 0.59, 0.11));
7
- vec3 bg = vec3(luminance, luminance, luminance);
8
-
9
- return vec4(bg, color.a);
10
- }
@@ -1,38 +0,0 @@
1
- import type { ShaderProgram } from "../../../../utils/shaderCodeUtils";
2
-
3
- /**
4
- * The shader program for the block.
5
- */
6
- export const shaderProgram: ShaderProgram = {
7
- vertex: undefined,
8
- fragment: {
9
- uniform: `
10
- uniform sampler2D _input_; // main`,
11
- mainInputTexture: "_input_",
12
- mainFunctionName: "_blackAndWhite_",
13
- functions: [
14
- {
15
- name: "_blackAndWhite_",
16
- code: `
17
- vec4 _blackAndWhite_(vec2 vUV) {
18
- vec4 color = texture2D(_input_, vUV);
19
-
20
- float luminance = dot(color.rgb, vec3(0.3, 0.59, 0.11));
21
- vec3 bg = vec3(luminance, luminance, luminance);
22
-
23
- return vec4(bg, color.a);
24
- }
25
-
26
- `,
27
- },
28
- ],
29
- },
30
- };
31
-
32
- /**
33
- * The uniform names for this shader, to be used in the shader binding so
34
- * that the names are always in sync.
35
- */
36
- export const uniforms = {
37
- input: "input",
38
- };
@@ -1,80 +0,0 @@
1
- import type { Effect } from "@babylonjs/core/Materials/effect";
2
- import { blackAndWhiteBlockType } from "../../../blockTypes.js";
3
- import { DisableableShaderBinding } from "../../../../runtime/shaderRuntime.js";
4
- import { DisableableShaderBlock } from "../../../../blockFoundation/disableableShaderBlock.js";
5
- import type { RuntimeData } from "../../../../connection/connectionPoint.js";
6
- import { ConnectionPointType } from "../../../../connection/connectionPointType.js";
7
- import type { SmartFilter } from "../../../../smartFilter.js";
8
-
9
- import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
10
- import { shaderProgram, uniforms } from "./blackAndWhiteBlock.shader.js";
11
-
12
- /**
13
- * The shader bindings for the BlackAndWhite block.
14
- */
15
- export class BlackAndWhiteShaderBinding extends DisableableShaderBinding {
16
- private readonly _inputTexture: RuntimeData<ConnectionPointType.Texture>;
17
-
18
- /**
19
- * Creates a new shader binding instance for the BlackAndWhite block.
20
- * @param parentBlock - The parent block
21
- * @param inputTexture - The input texture
22
- */
23
- constructor(parentBlock: DisableableShaderBlock, inputTexture: RuntimeData<ConnectionPointType.Texture>) {
24
- super(parentBlock);
25
- this._inputTexture = inputTexture;
26
- }
27
-
28
- /**
29
- * Binds all the required data to the shader when rendering.
30
- * @param effect - defines the effect to bind the data to
31
- */
32
- public override bind(effect: Effect): void {
33
- super.bind(effect);
34
- effect.setTexture(this.getRemappedName(uniforms.input), this._inputTexture.value);
35
- }
36
- }
37
-
38
- /**
39
- * A simple block converting the input texture to black and white.
40
- */
41
- export class BlackAndWhiteBlock extends DisableableShaderBlock {
42
- /**
43
- * The class name of the block.
44
- */
45
- public static override ClassName = blackAndWhiteBlockType;
46
-
47
- /**
48
- * The namespace of the block.
49
- */
50
- public static override Namespace = babylonDemoEffectsNamespace;
51
-
52
- /**
53
- * The input texture connection point.
54
- */
55
- public readonly input = this._registerInput("input", ConnectionPointType.Texture);
56
-
57
- /**
58
- * The shader program (vertex and fragment code) to use to render the block
59
- */
60
- public static override ShaderCode = shaderProgram;
61
-
62
- /**
63
- * Instantiates a new Block.
64
- * @param smartFilter - The smart filter this block belongs to
65
- * @param name - The friendly name of the block
66
- */
67
- constructor(smartFilter: SmartFilter, name: string) {
68
- super(smartFilter, name);
69
- }
70
-
71
- /**
72
- * Get the class instance that binds all the required data to the shader (effect) when rendering.
73
- * @returns The class instance that binds the data to the effect
74
- */
75
- public getShaderBinding(): DisableableShaderBinding {
76
- const input = this._confirmRuntimeDataSupplied(this.input);
77
-
78
- return new BlackAndWhiteShaderBinding(this, input);
79
- }
80
- }
@@ -1,38 +0,0 @@
1
- import type { ISerializedBlockV1 } from "../../../../serialization/index.js";
2
- import { BlurBlock } from "./blurBlock.js";
3
- import type { SmartFilter } from "../../../../smartFilter.js";
4
-
5
- /**
6
- * The definition of the extra data serialized for blur blocks.
7
- */
8
- export interface ISerializedBlurBlockV1 extends ISerializedBlockV1 {
9
- /**
10
- * The extra data of the block.
11
- */
12
- data: {
13
- /**
14
- * The blur texture ratio per pass.
15
- */
16
- blurTextureRatioPerPass: number;
17
-
18
- /**
19
- * The size of the blur.
20
- */
21
- blurSize: number;
22
- };
23
- }
24
-
25
- /**
26
- * V1 Blur Deserializer.
27
- * @param smartFilter - The SmartFilter to deserialize the block into
28
- * @param serializedBlock - The serialized block data
29
- * @returns A deserialized BlurBlock
30
- */
31
- export function blurBlockDeserializer(smartFilter: SmartFilter, serializedBlock: ISerializedBlurBlockV1) {
32
- const block = new BlurBlock(smartFilter, serializedBlock.name);
33
-
34
- // If data is missing, use the default value set by the block
35
- block.blurTextureRatioPerPass = serializedBlock.data.blurTextureRatioPerPass ?? block.blurSize;
36
- block.blurSize = serializedBlock.data.blurSize ?? block.blurSize;
37
- return block;
38
- }
@@ -1,32 +0,0 @@
1
- import type { IBlockSerializerV1 } from "../../../../serialization/v1/smartFilterSerialization.types";
2
- import type { BaseBlock } from "../../../../blockFoundation/baseBlock";
3
- import type { BlurBlock } from "./blurBlock";
4
- import { blurBlockType } from "../../../blockTypes.js";
5
- import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
6
-
7
- /**
8
- * The V1 serializer for a Blur Block.
9
- * Though it is an aggregate block, Blur creates and manages its own blocks
10
- * internally, so there's no need to worry about serializing them.
11
- */
12
- export const blurBlockSerializer: IBlockSerializerV1 = {
13
- blockType: blurBlockType,
14
- serialize: (block: BaseBlock) => {
15
- if (block.getClassName() !== blurBlockType) {
16
- throw new Error("Was asked to serialize an unrecognized block type");
17
- }
18
-
19
- const blurBlock = block as BlurBlock;
20
- return {
21
- name: block.name,
22
- uniqueId: block.uniqueId,
23
- blockType: blurBlockType,
24
- namespace: babylonDemoEffectsNamespace,
25
- comments: block.comments,
26
- data: {
27
- blurTextureRatioPerPass: blurBlock.blurTextureRatioPerPass,
28
- blurSize: blurBlock.blurSize,
29
- },
30
- };
31
- },
32
- };