@babylonjs/smart-filters 0.7.8-alpha → 0.7.10-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 (370) hide show
  1. package/dist/{blocks → blockFoundation}/aggregateBlock.d.ts +1 -1
  2. package/dist/blockFoundation/aggregateBlock.d.ts.map +1 -0
  3. package/dist/{blocks → blockFoundation}/aggregateBlock.js +1 -1
  4. package/dist/blockFoundation/aggregateBlock.js.map +1 -0
  5. package/dist/{blocks → blockFoundation}/baseBlock.d.ts +2 -2
  6. package/dist/blockFoundation/baseBlock.d.ts.map +1 -0
  7. package/dist/blockFoundation/baseBlock.js.map +1 -0
  8. package/dist/blockFoundation/customAggregateBlock.d.ts.map +1 -0
  9. package/dist/blockFoundation/customAggregateBlock.js.map +1 -0
  10. package/dist/{blocks → blockFoundation}/customShaderBlock.d.ts +2 -2
  11. package/dist/blockFoundation/customShaderBlock.d.ts.map +1 -0
  12. package/dist/blockFoundation/customShaderBlock.js.map +1 -0
  13. package/dist/blockFoundation/disableableShaderBlock.d.ts.map +1 -0
  14. package/dist/blockFoundation/disableableShaderBlock.js.map +1 -0
  15. package/dist/blockFoundation/index.d.ts +10 -0
  16. package/dist/blockFoundation/index.d.ts.map +1 -0
  17. package/dist/blockFoundation/index.js +10 -0
  18. package/dist/blockFoundation/index.js.map +1 -0
  19. package/dist/{blocks → blockFoundation}/inputBlock.d.ts +1 -1
  20. package/dist/blockFoundation/inputBlock.d.ts.map +1 -0
  21. package/dist/blockFoundation/inputBlock.deserializer.d.ts.map +1 -0
  22. package/dist/blockFoundation/inputBlock.deserializer.js.map +1 -0
  23. package/dist/{blocks → blockFoundation}/inputBlock.js +1 -1
  24. package/dist/blockFoundation/inputBlock.js.map +1 -0
  25. package/dist/blockFoundation/inputBlock.serialization.types.d.ts.map +1 -0
  26. package/dist/blockFoundation/inputBlock.serialization.types.js.map +1 -0
  27. package/dist/blockFoundation/inputBlock.serializer.d.ts.map +1 -0
  28. package/dist/blockFoundation/inputBlock.serializer.js.map +1 -0
  29. package/dist/blockFoundation/outputBlock.d.ts.map +1 -0
  30. package/dist/blockFoundation/outputBlock.js.map +1 -0
  31. package/dist/blockFoundation/outputBlock.shader.d.ts.map +1 -0
  32. package/dist/blockFoundation/outputBlock.shader.js.map +1 -0
  33. package/dist/blockFoundation/shaderBlock.d.ts.map +1 -0
  34. package/dist/blockFoundation/shaderBlock.js.map +1 -0
  35. package/dist/blockFoundation/textureOptions.d.ts.map +1 -0
  36. package/dist/blockFoundation/textureOptions.js.map +1 -0
  37. package/dist/blockRegistration/IBlockRegistration.d.ts +36 -0
  38. package/dist/blockRegistration/IBlockRegistration.d.ts.map +1 -0
  39. package/dist/blockRegistration/IBlockRegistration.js +2 -0
  40. package/dist/blockRegistration/IBlockRegistration.js.map +1 -0
  41. package/dist/blockRegistration/blockSerializers.d.ts +13 -0
  42. package/dist/blockRegistration/blockSerializers.d.ts.map +1 -0
  43. package/dist/blockRegistration/blockSerializers.js +35 -0
  44. package/dist/blockRegistration/blockSerializers.js.map +1 -0
  45. package/dist/blockRegistration/builtInBlockRegistrations.d.ts +13 -0
  46. package/dist/blockRegistration/builtInBlockRegistrations.d.ts.map +1 -0
  47. package/dist/blockRegistration/builtInBlockRegistrations.js +266 -0
  48. package/dist/blockRegistration/builtInBlockRegistrations.js.map +1 -0
  49. package/dist/blockRegistration/index.d.ts +3 -0
  50. package/dist/blockRegistration/index.d.ts.map +1 -0
  51. package/dist/blockRegistration/index.js +3 -0
  52. package/dist/blockRegistration/index.js.map +1 -0
  53. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.d.ts +56 -0
  54. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.d.ts.map +1 -0
  55. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.js +66 -0
  56. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.js.map +1 -0
  57. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.shader.d.ts +13 -0
  58. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.shader.d.ts.map +1 -0
  59. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.shader.js +36 -0
  60. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.shader.js.map +1 -0
  61. package/dist/blocks/babylon/demo/effects/blurBlock.d.ts +56 -0
  62. package/dist/blocks/babylon/demo/effects/blurBlock.d.ts.map +1 -0
  63. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.d.ts +29 -0
  64. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.d.ts.map +1 -0
  65. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.js +16 -0
  66. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.js.map +1 -0
  67. package/dist/blocks/babylon/demo/effects/blurBlock.js +100 -0
  68. package/dist/blocks/babylon/demo/effects/blurBlock.js.map +1 -0
  69. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.d.ts +8 -0
  70. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.d.ts.map +1 -0
  71. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.js +28 -0
  72. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.js.map +1 -0
  73. package/dist/blocks/babylon/demo/effects/compositionBlock.d.ts +118 -0
  74. package/dist/blocks/babylon/demo/effects/compositionBlock.d.ts.map +1 -0
  75. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.d.ts +25 -0
  76. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.d.ts.map +1 -0
  77. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.js +15 -0
  78. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.js.map +1 -0
  79. package/dist/blocks/babylon/demo/effects/compositionBlock.js +219 -0
  80. package/dist/blocks/babylon/demo/effects/compositionBlock.js.map +1 -0
  81. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.d.ts +6 -0
  82. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.d.ts.map +1 -0
  83. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.js +25 -0
  84. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.js.map +1 -0
  85. package/dist/blocks/babylon/demo/effects/contrastBlock.d.ts +63 -0
  86. package/dist/blocks/babylon/demo/effects/contrastBlock.d.ts.map +1 -0
  87. package/dist/blocks/babylon/demo/effects/contrastBlock.js +122 -0
  88. package/dist/blocks/babylon/demo/effects/contrastBlock.js.map +1 -0
  89. package/dist/blocks/babylon/demo/effects/desaturateBlock.d.ts +63 -0
  90. package/dist/blocks/babylon/demo/effects/desaturateBlock.d.ts.map +1 -0
  91. package/dist/blocks/babylon/demo/effects/desaturateBlock.js +107 -0
  92. package/dist/blocks/babylon/demo/effects/desaturateBlock.js.map +1 -0
  93. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.d.ts +79 -0
  94. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.d.ts.map +1 -0
  95. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.d.ts +33 -0
  96. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.d.ts.map +1 -0
  97. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.js +17 -0
  98. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.js.map +1 -0
  99. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.js +171 -0
  100. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.js.map +1 -0
  101. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.d.ts +6 -0
  102. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.d.ts.map +1 -0
  103. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.js +27 -0
  104. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.js.map +1 -0
  105. package/dist/blocks/babylon/demo/effects/exposureBlock.d.ts +63 -0
  106. package/dist/blocks/babylon/demo/effects/exposureBlock.d.ts.map +1 -0
  107. package/dist/blocks/babylon/demo/effects/exposureBlock.js +95 -0
  108. package/dist/blocks/babylon/demo/effects/exposureBlock.js.map +1 -0
  109. package/dist/blocks/babylon/demo/effects/greenScreenBlock.d.ts +75 -0
  110. package/dist/blocks/babylon/demo/effects/greenScreenBlock.d.ts.map +1 -0
  111. package/dist/blocks/babylon/demo/effects/greenScreenBlock.js +121 -0
  112. package/dist/blocks/babylon/demo/effects/greenScreenBlock.js.map +1 -0
  113. package/dist/blocks/babylon/demo/effects/index.d.ts +15 -0
  114. package/dist/blocks/babylon/demo/effects/index.d.ts.map +1 -0
  115. package/dist/blocks/babylon/demo/effects/index.js +15 -0
  116. package/dist/blocks/babylon/demo/effects/index.js.map +1 -0
  117. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.d.ts +63 -0
  118. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.d.ts.map +1 -0
  119. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.js +159 -0
  120. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.js.map +1 -0
  121. package/dist/blocks/babylon/demo/effects/maskBlock.d.ts +62 -0
  122. package/dist/blocks/babylon/demo/effects/maskBlock.d.ts.map +1 -0
  123. package/dist/blocks/babylon/demo/effects/maskBlock.js +75 -0
  124. package/dist/blocks/babylon/demo/effects/maskBlock.js.map +1 -0
  125. package/dist/blocks/babylon/demo/effects/maskBlock.shader.d.ts +14 -0
  126. package/dist/blocks/babylon/demo/effects/maskBlock.shader.d.ts.map +1 -0
  127. package/dist/blocks/babylon/demo/effects/maskBlock.shader.js +37 -0
  128. package/dist/blocks/babylon/demo/effects/maskBlock.shader.js.map +1 -0
  129. package/dist/blocks/babylon/demo/effects/pixelateBlock.d.ts +62 -0
  130. package/dist/blocks/babylon/demo/effects/pixelateBlock.d.ts.map +1 -0
  131. package/dist/blocks/babylon/demo/effects/pixelateBlock.js +77 -0
  132. package/dist/blocks/babylon/demo/effects/pixelateBlock.js.map +1 -0
  133. package/dist/blocks/babylon/demo/effects/pixelateBlock.shader.d.ts +15 -0
  134. package/dist/blocks/babylon/demo/effects/pixelateBlock.shader.d.ts.map +1 -0
  135. package/dist/blocks/babylon/demo/effects/pixelateBlock.shader.js +44 -0
  136. package/dist/blocks/babylon/demo/effects/pixelateBlock.shader.js.map +1 -0
  137. package/dist/blocks/babylon/demo/effects/posterizeBlock.d.ts +63 -0
  138. package/dist/blocks/babylon/demo/effects/posterizeBlock.d.ts.map +1 -0
  139. package/dist/blocks/babylon/demo/effects/posterizeBlock.js +108 -0
  140. package/dist/blocks/babylon/demo/effects/posterizeBlock.js.map +1 -0
  141. package/dist/blocks/babylon/demo/effects/spritesheetBlock.d.ts +81 -0
  142. package/dist/blocks/babylon/demo/effects/spritesheetBlock.d.ts.map +1 -0
  143. package/dist/blocks/babylon/demo/effects/spritesheetBlock.js +103 -0
  144. package/dist/blocks/babylon/demo/effects/spritesheetBlock.js.map +1 -0
  145. package/dist/blocks/babylon/demo/effects/spritesheetBlock.shader.d.ts +18 -0
  146. package/dist/blocks/babylon/demo/effects/spritesheetBlock.shader.d.ts.map +1 -0
  147. package/dist/blocks/babylon/demo/effects/spritesheetBlock.shader.js +57 -0
  148. package/dist/blocks/babylon/demo/effects/spritesheetBlock.shader.js.map +1 -0
  149. package/dist/blocks/babylon/demo/effects/tintBlock.d.ts +7 -0
  150. package/dist/blocks/babylon/demo/effects/tintBlock.d.ts.map +1 -0
  151. package/dist/blocks/babylon/demo/effects/tintBlock.js +51 -0
  152. package/dist/blocks/babylon/demo/effects/tintBlock.js.map +1 -0
  153. package/dist/blocks/babylon/demo/transitions/index.d.ts +2 -0
  154. package/dist/blocks/babylon/demo/transitions/index.d.ts.map +1 -0
  155. package/dist/blocks/babylon/demo/transitions/index.js +2 -0
  156. package/dist/blocks/babylon/demo/transitions/index.js.map +1 -0
  157. package/dist/blocks/babylon/demo/transitions/wipeBlock.d.ts +69 -0
  158. package/dist/blocks/babylon/demo/transitions/wipeBlock.d.ts.map +1 -0
  159. package/dist/blocks/babylon/demo/transitions/wipeBlock.js +110 -0
  160. package/dist/blocks/babylon/demo/transitions/wipeBlock.js.map +1 -0
  161. package/dist/blocks/babylon/demo/utilities/index.d.ts +2 -0
  162. package/dist/blocks/babylon/demo/utilities/index.d.ts.map +1 -0
  163. package/dist/blocks/babylon/demo/utilities/index.js +2 -0
  164. package/dist/blocks/babylon/demo/utilities/index.js.map +1 -0
  165. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.d.ts +58 -0
  166. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.d.ts.map +1 -0
  167. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.js +87 -0
  168. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.js.map +1 -0
  169. package/dist/blocks/blockNamespaces.d.ts +5 -0
  170. package/dist/blocks/blockNamespaces.d.ts.map +1 -0
  171. package/dist/blocks/blockNamespaces.js +5 -0
  172. package/dist/blocks/blockNamespaces.js.map +1 -0
  173. package/dist/blocks/blockTypes.d.ts +22 -0
  174. package/dist/blocks/blockTypes.d.ts.map +1 -0
  175. package/dist/blocks/blockTypes.js +22 -0
  176. package/dist/blocks/blockTypes.js.map +1 -0
  177. package/dist/blocks/index.d.ts +6 -0
  178. package/dist/blocks/index.d.ts.map +1 -0
  179. package/dist/blocks/index.js +6 -0
  180. package/dist/blocks/index.js.map +1 -0
  181. package/dist/command/index.d.ts +4 -0
  182. package/dist/command/index.d.ts.map +1 -0
  183. package/dist/command/index.js +4 -0
  184. package/dist/command/index.js.map +1 -0
  185. package/dist/connection/connectionPoint.d.ts +1 -1
  186. package/dist/connection/connectionPoint.d.ts.map +1 -1
  187. package/dist/connection/connectionPointWithDefault.d.ts +1 -1
  188. package/dist/connection/connectionPointWithDefault.d.ts.map +1 -1
  189. package/dist/connection/index.d.ts +7 -0
  190. package/dist/connection/index.d.ts.map +1 -0
  191. package/dist/connection/index.js +7 -0
  192. package/dist/connection/index.js.map +1 -0
  193. package/dist/editorUtils/index.d.ts +2 -0
  194. package/dist/editorUtils/index.d.ts.map +1 -0
  195. package/dist/editorUtils/index.js +2 -0
  196. package/dist/editorUtils/index.js.map +1 -0
  197. package/dist/index.d.ts +10 -30
  198. package/dist/index.d.ts.map +1 -1
  199. package/dist/index.js +10 -30
  200. package/dist/index.js.map +1 -1
  201. package/dist/optimization/index.d.ts +2 -0
  202. package/dist/optimization/index.d.ts.map +1 -0
  203. package/dist/optimization/index.js +2 -0
  204. package/dist/optimization/index.js.map +1 -0
  205. package/dist/optimization/optimizedShaderBlock.d.ts +1 -1
  206. package/dist/optimization/optimizedShaderBlock.d.ts.map +1 -1
  207. package/dist/optimization/optimizedShaderBlock.js +1 -1
  208. package/dist/optimization/optimizedShaderBlock.js.map +1 -1
  209. package/dist/optimization/smartFilterOptimizer.js +4 -4
  210. package/dist/optimization/smartFilterOptimizer.js.map +1 -1
  211. package/dist/runtime/index.d.ts +7 -0
  212. package/dist/runtime/index.d.ts.map +1 -0
  213. package/dist/runtime/index.js +7 -0
  214. package/dist/runtime/index.js.map +1 -0
  215. package/dist/runtime/renderTargetGenerator.js +1 -1
  216. package/dist/runtime/renderTargetGenerator.js.map +1 -1
  217. package/dist/runtime/shaderRuntime.d.ts +2 -2
  218. package/dist/runtime/shaderRuntime.d.ts.map +1 -1
  219. package/dist/serialization/index.d.ts +1 -0
  220. package/dist/serialization/index.d.ts.map +1 -1
  221. package/dist/serialization/index.js +1 -0
  222. package/dist/serialization/index.js.map +1 -1
  223. package/dist/serialization/smartFilterDeserializer.d.ts +1 -1
  224. package/dist/serialization/smartFilterDeserializer.d.ts.map +1 -1
  225. package/dist/serialization/smartFilterDeserializer.js +3 -3
  226. package/dist/serialization/smartFilterDeserializer.js.map +1 -1
  227. package/dist/serialization/smartFilterSerializer.js +4 -4
  228. package/dist/serialization/smartFilterSerializer.js.map +1 -1
  229. package/dist/serialization/v1/smartFilterSerialization.types.d.ts +1 -1
  230. package/dist/serialization/v1/smartFilterSerialization.types.d.ts.map +1 -1
  231. package/dist/smartFilter.d.ts +2 -2
  232. package/dist/smartFilter.d.ts.map +1 -1
  233. package/dist/smartFilter.js +3 -3
  234. package/dist/smartFilter.js.map +1 -1
  235. package/dist/utils/index.d.ts +3 -0
  236. package/dist/utils/index.d.ts.map +1 -0
  237. package/dist/utils/index.js +3 -0
  238. package/dist/utils/index.js.map +1 -0
  239. package/dist/utils/renderTargetUtils.d.ts +2 -2
  240. package/dist/utils/renderTargetUtils.d.ts.map +1 -1
  241. package/dist/utils/textureUtils.d.ts +1 -1
  242. package/dist/utils/textureUtils.d.ts.map +1 -1
  243. package/dist/version.d.ts +1 -1
  244. package/dist/version.d.ts.map +1 -1
  245. package/dist/version.js +1 -1
  246. package/dist/version.js.map +1 -1
  247. package/package.json +3 -6
  248. package/src/{blocks → blockFoundation}/aggregateBlock.ts +1 -1
  249. package/src/{blocks → blockFoundation}/baseBlock.ts +2 -2
  250. package/src/{blocks → blockFoundation}/customShaderBlock.ts +3 -3
  251. package/src/blockFoundation/index.ts +9 -0
  252. package/src/{blocks → blockFoundation}/inputBlock.serializer.ts +1 -1
  253. package/src/{blocks → blockFoundation}/inputBlock.ts +1 -1
  254. package/src/blockRegistration/IBlockRegistration.ts +45 -0
  255. package/src/blockRegistration/blockSerializers.ts +52 -0
  256. package/src/blockRegistration/builtInBlockRegistrations.ts +390 -0
  257. package/src/blockRegistration/index.ts +2 -0
  258. package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.fragment.glsl +10 -0
  259. package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.shader.ts +38 -0
  260. package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.ts +80 -0
  261. package/src/blocks/babylon/demo/effects/blurBlock.deserializer.ts +38 -0
  262. package/src/blocks/babylon/demo/effects/blurBlock.serializer.ts +32 -0
  263. package/src/blocks/babylon/demo/effects/blurBlock.ts +119 -0
  264. package/src/blocks/babylon/demo/effects/compositionBlock.deserializer.ts +32 -0
  265. package/src/blocks/babylon/demo/effects/compositionBlock.serializer.ts +29 -0
  266. package/src/blocks/babylon/demo/effects/compositionBlock.ts +293 -0
  267. package/src/blocks/babylon/demo/effects/contrastBlock.ts +152 -0
  268. package/src/blocks/babylon/demo/effects/desaturateBlock.ts +137 -0
  269. package/src/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.ts +47 -0
  270. package/src/blocks/babylon/demo/effects/directionalBlurBlock.serializer.ts +31 -0
  271. package/src/blocks/babylon/demo/effects/directionalBlurBlock.ts +193 -0
  272. package/src/blocks/babylon/demo/effects/exposureBlock.ts +120 -0
  273. package/src/blocks/babylon/demo/effects/greenScreenBlock.ts +152 -0
  274. package/src/blocks/babylon/demo/effects/index.ts +14 -0
  275. package/src/blocks/babylon/demo/effects/kaleidoscopeBlock.ts +186 -0
  276. package/src/blocks/babylon/demo/effects/maskBlock.fragment.glsl +10 -0
  277. package/src/blocks/babylon/demo/effects/maskBlock.shader.ts +39 -0
  278. package/src/blocks/babylon/demo/effects/maskBlock.ts +94 -0
  279. package/src/blocks/babylon/demo/effects/pixelateBlock.fragment.glsl +18 -0
  280. package/src/blocks/babylon/demo/effects/pixelateBlock.shader.ts +46 -0
  281. package/src/blocks/babylon/demo/effects/pixelateBlock.ts +101 -0
  282. package/src/blocks/babylon/demo/effects/posterizeBlock.ts +139 -0
  283. package/src/blocks/babylon/demo/effects/spritesheetBlock.fragment.glsl +26 -0
  284. package/src/blocks/babylon/demo/effects/spritesheetBlock.shader.ts +59 -0
  285. package/src/blocks/babylon/demo/effects/spritesheetBlock.ts +135 -0
  286. package/src/blocks/babylon/demo/effects/tintBlock.ts +52 -0
  287. package/src/blocks/babylon/demo/transitions/index.ts +1 -0
  288. package/src/blocks/babylon/demo/transitions/wipeBlock.ts +138 -0
  289. package/src/blocks/babylon/demo/utilities/index.ts +1 -0
  290. package/src/blocks/babylon/demo/utilities/premultiplyAlphaBlock.ts +106 -0
  291. package/src/blocks/blockNamespaces.ts +4 -0
  292. package/src/blocks/blockTypes.ts +21 -0
  293. package/src/blocks/index.ts +5 -0
  294. package/src/command/index.ts +3 -0
  295. package/src/connection/connectionPoint.ts +1 -1
  296. package/src/connection/connectionPointWithDefault.ts +1 -1
  297. package/src/connection/index.ts +9 -0
  298. package/src/editorUtils/index.ts +1 -0
  299. package/src/index.ts +11 -39
  300. package/src/optimization/index.ts +1 -0
  301. package/src/optimization/optimizedShaderBlock.ts +1 -1
  302. package/src/optimization/smartFilterOptimizer.ts +6 -6
  303. package/src/runtime/index.ts +6 -0
  304. package/src/runtime/renderTargetGenerator.ts +3 -3
  305. package/src/runtime/shaderRuntime.ts +2 -2
  306. package/src/serialization/index.ts +1 -0
  307. package/src/serialization/smartFilterDeserializer.ts +4 -4
  308. package/src/serialization/smartFilterSerializer.ts +5 -5
  309. package/src/serialization/v1/defaultBlockSerializer.ts +1 -1
  310. package/src/serialization/v1/smartFilterSerialization.types.ts +1 -1
  311. package/src/smartFilter.ts +4 -4
  312. package/src/utils/index.ts +2 -0
  313. package/src/utils/renderTargetUtils.ts +2 -2
  314. package/src/utils/textureUtils.ts +1 -1
  315. package/src/version.ts +1 -1
  316. package/dist/blocks/aggregateBlock.d.ts.map +0 -1
  317. package/dist/blocks/aggregateBlock.js.map +0 -1
  318. package/dist/blocks/baseBlock.d.ts.map +0 -1
  319. package/dist/blocks/baseBlock.js.map +0 -1
  320. package/dist/blocks/customAggregateBlock.d.ts.map +0 -1
  321. package/dist/blocks/customAggregateBlock.js.map +0 -1
  322. package/dist/blocks/customShaderBlock.d.ts.map +0 -1
  323. package/dist/blocks/customShaderBlock.js.map +0 -1
  324. package/dist/blocks/disableableShaderBlock.d.ts.map +0 -1
  325. package/dist/blocks/disableableShaderBlock.js.map +0 -1
  326. package/dist/blocks/inputBlock.d.ts.map +0 -1
  327. package/dist/blocks/inputBlock.deserializer.d.ts.map +0 -1
  328. package/dist/blocks/inputBlock.deserializer.js.map +0 -1
  329. package/dist/blocks/inputBlock.js.map +0 -1
  330. package/dist/blocks/inputBlock.serialization.types.d.ts.map +0 -1
  331. package/dist/blocks/inputBlock.serialization.types.js.map +0 -1
  332. package/dist/blocks/inputBlock.serializer.d.ts.map +0 -1
  333. package/dist/blocks/inputBlock.serializer.js.map +0 -1
  334. package/dist/blocks/outputBlock.d.ts.map +0 -1
  335. package/dist/blocks/outputBlock.js.map +0 -1
  336. package/dist/blocks/outputBlock.shader.d.ts.map +0 -1
  337. package/dist/blocks/outputBlock.shader.js.map +0 -1
  338. package/dist/blocks/shaderBlock.d.ts.map +0 -1
  339. package/dist/blocks/shaderBlock.js.map +0 -1
  340. package/dist/blocks/textureOptions.d.ts.map +0 -1
  341. package/dist/blocks/textureOptions.js.map +0 -1
  342. /package/dist/{blocks → blockFoundation}/baseBlock.js +0 -0
  343. /package/dist/{blocks → blockFoundation}/customAggregateBlock.d.ts +0 -0
  344. /package/dist/{blocks → blockFoundation}/customAggregateBlock.js +0 -0
  345. /package/dist/{blocks → blockFoundation}/customShaderBlock.js +0 -0
  346. /package/dist/{blocks → blockFoundation}/disableableShaderBlock.d.ts +0 -0
  347. /package/dist/{blocks → blockFoundation}/disableableShaderBlock.js +0 -0
  348. /package/dist/{blocks → blockFoundation}/inputBlock.deserializer.d.ts +0 -0
  349. /package/dist/{blocks → blockFoundation}/inputBlock.deserializer.js +0 -0
  350. /package/dist/{blocks → blockFoundation}/inputBlock.serialization.types.d.ts +0 -0
  351. /package/dist/{blocks → blockFoundation}/inputBlock.serialization.types.js +0 -0
  352. /package/dist/{blocks → blockFoundation}/inputBlock.serializer.d.ts +0 -0
  353. /package/dist/{blocks → blockFoundation}/inputBlock.serializer.js +0 -0
  354. /package/dist/{blocks → blockFoundation}/outputBlock.d.ts +0 -0
  355. /package/dist/{blocks → blockFoundation}/outputBlock.js +0 -0
  356. /package/dist/{blocks → blockFoundation}/outputBlock.shader.d.ts +0 -0
  357. /package/dist/{blocks → blockFoundation}/outputBlock.shader.js +0 -0
  358. /package/dist/{blocks → blockFoundation}/shaderBlock.d.ts +0 -0
  359. /package/dist/{blocks → blockFoundation}/shaderBlock.js +0 -0
  360. /package/dist/{blocks → blockFoundation}/textureOptions.d.ts +0 -0
  361. /package/dist/{blocks → blockFoundation}/textureOptions.js +0 -0
  362. /package/src/{blocks → blockFoundation}/customAggregateBlock.ts +0 -0
  363. /package/src/{blocks → blockFoundation}/disableableShaderBlock.ts +0 -0
  364. /package/src/{blocks → blockFoundation}/inputBlock.deserializer.ts +0 -0
  365. /package/src/{blocks → blockFoundation}/inputBlock.serialization.types.ts +0 -0
  366. /package/src/{blocks → blockFoundation}/outputBlock.fragment.glsl +0 -0
  367. /package/src/{blocks → blockFoundation}/outputBlock.shader.ts +0 -0
  368. /package/src/{blocks → blockFoundation}/outputBlock.ts +0 -0
  369. /package/src/{blocks → blockFoundation}/shaderBlock.ts +0 -0
  370. /package/src/{blocks → blockFoundation}/textureOptions.ts +0 -0
@@ -9,7 +9,7 @@ import type {
9
9
  SerializedInputBlockData,
10
10
  TextureInputBlockData,
11
11
  Vector2InputBlockData,
12
- } from "./inputBlock.serialization.types";
12
+ } from "./inputBlock.serialization.types.js";
13
13
  import type { IBlockSerializerV1 } from "../serialization/v1/smartFilterSerialization.types.js";
14
14
 
15
15
  /**
@@ -3,7 +3,7 @@ import type { ConnectionPointValue } from "../connection/connectionPointType";
3
3
  import type { RuntimeData } from "../connection/connectionPoint";
4
4
  import type { ConnectionPointWithDefault } from "../connection/connectionPointWithDefault";
5
5
  import type { DisableableShaderBlock } from "./disableableShaderBlock";
6
- import { BaseBlock } from "../blocks/baseBlock.js";
6
+ import { BaseBlock } from "./baseBlock.js";
7
7
  import { createStrongRef } from "../runtime/strongRef.js";
8
8
  import { ConnectionPointType } from "../connection/connectionPointType.js";
9
9
  import type { Nullable } from "@babylonjs/core/types";
@@ -0,0 +1,45 @@
1
+ import type { ThinEngine } from "@babylonjs/core/Engines/thinEngine";
2
+ import type { SmartFilter } from "../smartFilter";
3
+ import type { BaseBlock } from "../blockFoundation";
4
+ import type { SmartFilterDeserializer, ISerializedBlockV1 } from "../serialization";
5
+
6
+ /**
7
+ * An object which describes a block definition, as well as a factory for creating a new instance of the block or
8
+ * deserializing it
9
+ */
10
+ export interface IBlockRegistration {
11
+ /**
12
+ * The block type of the block
13
+ */
14
+ blockType: string;
15
+
16
+ /**
17
+ * Creates an instance of the block, either fresh or deserialized from a serialized block
18
+ * @param smartFilter - The smart filter to create the block for
19
+ * @param engine - The engine to use for creating blocks
20
+ * @param smartFilterDeserializer - The deserializer to use for deserializing blocks
21
+ * @param serializedBlock - The serialized block to deserialize, if any
22
+ * @returns - A promise for a new instance of the block
23
+ */
24
+ factory?: (
25
+ smartFilter: SmartFilter,
26
+ engine: ThinEngine,
27
+ smartFilterDeserializer: SmartFilterDeserializer,
28
+ serializedBlock?: ISerializedBlockV1
29
+ ) => Promise<BaseBlock>;
30
+
31
+ /**
32
+ * The namespace of the block
33
+ */
34
+ namespace: string;
35
+
36
+ /**
37
+ * A tooltip for the block if displayed in an editor, for instance
38
+ */
39
+ tooltip: string;
40
+
41
+ /**
42
+ * If true, this represents a custom block (not one that was programmatically included)
43
+ */
44
+ isCustom?: boolean;
45
+ }
@@ -0,0 +1,52 @@
1
+ import { blurBlockSerializer } from "../blocks/babylon/demo/effects/blurBlock.serializer.js";
2
+ import { directionalBlurBlockSerializer } from "../blocks/babylon/demo/effects/directionalBlurBlock.serializer.js";
3
+ import { compositionBlockSerializer } from "../blocks/babylon/demo/effects/compositionBlock.serializer.js";
4
+ import type { IBlockSerializerV1 } from "../serialization/v1/smartFilterSerialization.types.js";
5
+ import {
6
+ blackAndWhiteBlockType,
7
+ pixelateBlockType,
8
+ exposureBlockType,
9
+ contrastBlockType,
10
+ desaturateBlockType,
11
+ posterizeBlockType,
12
+ kaleidoscopeBlockType,
13
+ greenScreenBlockType,
14
+ maskBlockType,
15
+ particleBlockType,
16
+ spritesheetBlockType,
17
+ tintBlockType,
18
+ premultiplyAlphaBlockType,
19
+ wipeBlockType,
20
+ } from "../blocks/blockTypes.js";
21
+
22
+ /**
23
+ * Any blocks that do not need to make use of ISerializedBlockV1.data can use the default serialization and
24
+ * should go in this list. If the serializer needs to store additional info in ISerializedBlockV1.data (e.g.
25
+ * webcam source name), then it should be registered in additionalBlockSerializers below.
26
+ */
27
+ export const blocksUsingDefaultSerialization: string[] = [
28
+ blackAndWhiteBlockType,
29
+ pixelateBlockType,
30
+ exposureBlockType,
31
+ contrastBlockType,
32
+ desaturateBlockType,
33
+ posterizeBlockType,
34
+ kaleidoscopeBlockType,
35
+ greenScreenBlockType,
36
+ maskBlockType,
37
+ particleBlockType,
38
+ spritesheetBlockType,
39
+ tintBlockType,
40
+ premultiplyAlphaBlockType,
41
+ wipeBlockType,
42
+ ];
43
+
44
+ /**
45
+ * Any blocks which require serializing more information than just the connections should be registered here.
46
+ * They should make use of the ISerializedBlockV1.data field to store this information.
47
+ */
48
+ export const additionalBlockSerializers: IBlockSerializerV1[] = [
49
+ blurBlockSerializer,
50
+ directionalBlurBlockSerializer,
51
+ compositionBlockSerializer,
52
+ ];
@@ -0,0 +1,390 @@
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
+ ];
@@ -0,0 +1,2 @@
1
+ export * from "./builtInBlockRegistrations.js";
2
+ export * from "./IBlockRegistration.js";
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,38 @@
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
+ };
@@ -0,0 +1,80 @@
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
+ }
@@ -0,0 +1,38 @@
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
+ }