@babylonjs/smart-filters 0.7.7-alpha → 0.7.9-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 (368) 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.js +1 -1
  245. package/package.json +3 -6
  246. package/src/{blocks → blockFoundation}/aggregateBlock.ts +1 -1
  247. package/src/{blocks → blockFoundation}/baseBlock.ts +2 -2
  248. package/src/{blocks → blockFoundation}/customShaderBlock.ts +3 -3
  249. package/src/blockFoundation/index.ts +9 -0
  250. package/src/{blocks → blockFoundation}/inputBlock.serializer.ts +1 -1
  251. package/src/{blocks → blockFoundation}/inputBlock.ts +1 -1
  252. package/src/blockRegistration/IBlockRegistration.ts +45 -0
  253. package/src/blockRegistration/blockSerializers.ts +52 -0
  254. package/src/blockRegistration/builtInBlockRegistrations.ts +390 -0
  255. package/src/blockRegistration/index.ts +2 -0
  256. package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.fragment.glsl +10 -0
  257. package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.shader.ts +38 -0
  258. package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.ts +80 -0
  259. package/src/blocks/babylon/demo/effects/blurBlock.deserializer.ts +38 -0
  260. package/src/blocks/babylon/demo/effects/blurBlock.serializer.ts +32 -0
  261. package/src/blocks/babylon/demo/effects/blurBlock.ts +119 -0
  262. package/src/blocks/babylon/demo/effects/compositionBlock.deserializer.ts +32 -0
  263. package/src/blocks/babylon/demo/effects/compositionBlock.serializer.ts +29 -0
  264. package/src/blocks/babylon/demo/effects/compositionBlock.ts +293 -0
  265. package/src/blocks/babylon/demo/effects/contrastBlock.ts +152 -0
  266. package/src/blocks/babylon/demo/effects/desaturateBlock.ts +137 -0
  267. package/src/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.ts +47 -0
  268. package/src/blocks/babylon/demo/effects/directionalBlurBlock.serializer.ts +31 -0
  269. package/src/blocks/babylon/demo/effects/directionalBlurBlock.ts +193 -0
  270. package/src/blocks/babylon/demo/effects/exposureBlock.ts +120 -0
  271. package/src/blocks/babylon/demo/effects/greenScreenBlock.ts +152 -0
  272. package/src/blocks/babylon/demo/effects/index.ts +14 -0
  273. package/src/blocks/babylon/demo/effects/kaleidoscopeBlock.ts +186 -0
  274. package/src/blocks/babylon/demo/effects/maskBlock.fragment.glsl +10 -0
  275. package/src/blocks/babylon/demo/effects/maskBlock.shader.ts +39 -0
  276. package/src/blocks/babylon/demo/effects/maskBlock.ts +94 -0
  277. package/src/blocks/babylon/demo/effects/pixelateBlock.fragment.glsl +18 -0
  278. package/src/blocks/babylon/demo/effects/pixelateBlock.shader.ts +46 -0
  279. package/src/blocks/babylon/demo/effects/pixelateBlock.ts +101 -0
  280. package/src/blocks/babylon/demo/effects/posterizeBlock.ts +139 -0
  281. package/src/blocks/babylon/demo/effects/spritesheetBlock.fragment.glsl +26 -0
  282. package/src/blocks/babylon/demo/effects/spritesheetBlock.shader.ts +59 -0
  283. package/src/blocks/babylon/demo/effects/spritesheetBlock.ts +135 -0
  284. package/src/blocks/babylon/demo/effects/tintBlock.ts +52 -0
  285. package/src/blocks/babylon/demo/transitions/index.ts +1 -0
  286. package/src/blocks/babylon/demo/transitions/wipeBlock.ts +138 -0
  287. package/src/blocks/babylon/demo/utilities/index.ts +1 -0
  288. package/src/blocks/babylon/demo/utilities/premultiplyAlphaBlock.ts +106 -0
  289. package/src/blocks/blockNamespaces.ts +4 -0
  290. package/src/blocks/blockTypes.ts +21 -0
  291. package/src/blocks/index.ts +5 -0
  292. package/src/command/index.ts +3 -0
  293. package/src/connection/connectionPoint.ts +1 -1
  294. package/src/connection/connectionPointWithDefault.ts +1 -1
  295. package/src/connection/index.ts +9 -0
  296. package/src/editorUtils/index.ts +1 -0
  297. package/src/index.ts +11 -39
  298. package/src/optimization/index.ts +1 -0
  299. package/src/optimization/optimizedShaderBlock.ts +1 -1
  300. package/src/optimization/smartFilterOptimizer.ts +6 -6
  301. package/src/runtime/index.ts +6 -0
  302. package/src/runtime/renderTargetGenerator.ts +3 -3
  303. package/src/runtime/shaderRuntime.ts +2 -2
  304. package/src/serialization/index.ts +1 -0
  305. package/src/serialization/smartFilterDeserializer.ts +4 -4
  306. package/src/serialization/smartFilterSerializer.ts +5 -5
  307. package/src/serialization/v1/defaultBlockSerializer.ts +1 -1
  308. package/src/serialization/v1/smartFilterSerialization.types.ts +1 -1
  309. package/src/smartFilter.ts +4 -4
  310. package/src/utils/index.ts +2 -0
  311. package/src/utils/renderTargetUtils.ts +2 -2
  312. package/src/utils/textureUtils.ts +1 -1
  313. package/src/version.ts +1 -1
  314. package/dist/blocks/aggregateBlock.d.ts.map +0 -1
  315. package/dist/blocks/aggregateBlock.js.map +0 -1
  316. package/dist/blocks/baseBlock.d.ts.map +0 -1
  317. package/dist/blocks/baseBlock.js.map +0 -1
  318. package/dist/blocks/customAggregateBlock.d.ts.map +0 -1
  319. package/dist/blocks/customAggregateBlock.js.map +0 -1
  320. package/dist/blocks/customShaderBlock.d.ts.map +0 -1
  321. package/dist/blocks/customShaderBlock.js.map +0 -1
  322. package/dist/blocks/disableableShaderBlock.d.ts.map +0 -1
  323. package/dist/blocks/disableableShaderBlock.js.map +0 -1
  324. package/dist/blocks/inputBlock.d.ts.map +0 -1
  325. package/dist/blocks/inputBlock.deserializer.d.ts.map +0 -1
  326. package/dist/blocks/inputBlock.deserializer.js.map +0 -1
  327. package/dist/blocks/inputBlock.js.map +0 -1
  328. package/dist/blocks/inputBlock.serialization.types.d.ts.map +0 -1
  329. package/dist/blocks/inputBlock.serialization.types.js.map +0 -1
  330. package/dist/blocks/inputBlock.serializer.d.ts.map +0 -1
  331. package/dist/blocks/inputBlock.serializer.js.map +0 -1
  332. package/dist/blocks/outputBlock.d.ts.map +0 -1
  333. package/dist/blocks/outputBlock.js.map +0 -1
  334. package/dist/blocks/outputBlock.shader.d.ts.map +0 -1
  335. package/dist/blocks/outputBlock.shader.js.map +0 -1
  336. package/dist/blocks/shaderBlock.d.ts.map +0 -1
  337. package/dist/blocks/shaderBlock.js.map +0 -1
  338. package/dist/blocks/textureOptions.d.ts.map +0 -1
  339. package/dist/blocks/textureOptions.js.map +0 -1
  340. /package/dist/{blocks → blockFoundation}/baseBlock.js +0 -0
  341. /package/dist/{blocks → blockFoundation}/customAggregateBlock.d.ts +0 -0
  342. /package/dist/{blocks → blockFoundation}/customAggregateBlock.js +0 -0
  343. /package/dist/{blocks → blockFoundation}/customShaderBlock.js +0 -0
  344. /package/dist/{blocks → blockFoundation}/disableableShaderBlock.d.ts +0 -0
  345. /package/dist/{blocks → blockFoundation}/disableableShaderBlock.js +0 -0
  346. /package/dist/{blocks → blockFoundation}/inputBlock.deserializer.d.ts +0 -0
  347. /package/dist/{blocks → blockFoundation}/inputBlock.deserializer.js +0 -0
  348. /package/dist/{blocks → blockFoundation}/inputBlock.serialization.types.d.ts +0 -0
  349. /package/dist/{blocks → blockFoundation}/inputBlock.serialization.types.js +0 -0
  350. /package/dist/{blocks → blockFoundation}/inputBlock.serializer.d.ts +0 -0
  351. /package/dist/{blocks → blockFoundation}/inputBlock.serializer.js +0 -0
  352. /package/dist/{blocks → blockFoundation}/outputBlock.d.ts +0 -0
  353. /package/dist/{blocks → blockFoundation}/outputBlock.js +0 -0
  354. /package/dist/{blocks → blockFoundation}/outputBlock.shader.d.ts +0 -0
  355. /package/dist/{blocks → blockFoundation}/outputBlock.shader.js +0 -0
  356. /package/dist/{blocks → blockFoundation}/shaderBlock.d.ts +0 -0
  357. /package/dist/{blocks → blockFoundation}/shaderBlock.js +0 -0
  358. /package/dist/{blocks → blockFoundation}/textureOptions.d.ts +0 -0
  359. /package/dist/{blocks → blockFoundation}/textureOptions.js +0 -0
  360. /package/src/{blocks → blockFoundation}/customAggregateBlock.ts +0 -0
  361. /package/src/{blocks → blockFoundation}/disableableShaderBlock.ts +0 -0
  362. /package/src/{blocks → blockFoundation}/inputBlock.deserializer.ts +0 -0
  363. /package/src/{blocks → blockFoundation}/inputBlock.serialization.types.ts +0 -0
  364. /package/src/{blocks → blockFoundation}/outputBlock.fragment.glsl +0 -0
  365. /package/src/{blocks → blockFoundation}/outputBlock.shader.ts +0 -0
  366. /package/src/{blocks → blockFoundation}/outputBlock.ts +0 -0
  367. /package/src/{blocks → blockFoundation}/shaderBlock.ts +0 -0
  368. /package/src/{blocks → blockFoundation}/textureOptions.ts +0 -0
@@ -0,0 +1,137 @@
1
+ import type { Effect } from "@babylonjs/core/Materials/effect";
2
+
3
+ import { type RuntimeData } from "../../../../connection/connectionPoint.js";
4
+ import { ConnectionPointType } from "../../../../connection/connectionPointType.js";
5
+ import { type IDisableableBlock, DisableableShaderBlock } from "../../../../blockFoundation/disableableShaderBlock.js";
6
+ import { DisableableShaderBinding } from "../../../../runtime/shaderRuntime.js";
7
+ import type { ShaderProgram } from "../../../../utils/shaderCodeUtils.js";
8
+ import type { SmartFilter } from "../../../../smartFilter.js";
9
+ import { createStrongRef } from "../../../../runtime/strongRef.js";
10
+
11
+ import { desaturateBlockType } from "../../../blockTypes.js";
12
+ import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
13
+
14
+ const shaderProgram: ShaderProgram = {
15
+ fragment: {
16
+ uniform: `
17
+ uniform sampler2D _input_;
18
+ uniform float _intensity_;
19
+ `,
20
+
21
+ const: `
22
+ const float _aspect_ = 1.72;
23
+ `,
24
+
25
+ mainFunctionName: "_desaturate_",
26
+
27
+ mainInputTexture: "_input_",
28
+
29
+ functions: [
30
+ {
31
+ name: "_desaturate_",
32
+ code: `
33
+ vec4 _desaturate_(vec2 vUV)
34
+ {
35
+ float saturationStrength = 1. - _intensity_;
36
+
37
+ vec4 color = texture2D(_input_, vUV);
38
+
39
+ float tempMin = min(min(color.x, color.y), color.z);
40
+ float tempMax = max(max(color.x, color.y), color.z);
41
+ float tempMerge = 0.5 * (tempMin + tempMax);
42
+
43
+ return vec4(mix(color.rgb, vec3(tempMerge, tempMerge, tempMerge), saturationStrength), color.a);
44
+ }
45
+ `,
46
+ },
47
+ ],
48
+ },
49
+ };
50
+
51
+ /**
52
+ * The shader bindings for the Desaturate block.
53
+ */
54
+ export class DesaturateShaderBinding extends DisableableShaderBinding {
55
+ private readonly _inputTexture: RuntimeData<ConnectionPointType.Texture>;
56
+ private readonly _intensity: RuntimeData<ConnectionPointType.Float>;
57
+
58
+ /**
59
+ * Creates a new shader binding instance for the Desaturate block.
60
+ * @param parentBlock - The parent block
61
+ * @param inputTexture - The input texture
62
+ * @param intensity - The intensity of the desaturation
63
+ */
64
+ constructor(
65
+ parentBlock: IDisableableBlock,
66
+ inputTexture: RuntimeData<ConnectionPointType.Texture>,
67
+ intensity: RuntimeData<ConnectionPointType.Float>
68
+ ) {
69
+ super(parentBlock);
70
+ this._inputTexture = inputTexture;
71
+ this._intensity = intensity;
72
+ }
73
+
74
+ /**
75
+ * Binds all the required data to the shader when rendering.
76
+ * @param effect - defines the effect to bind the data to
77
+ */
78
+ public override bind(effect: Effect): void {
79
+ super.bind(effect);
80
+ effect.setTexture(this.getRemappedName("input"), this._inputTexture.value);
81
+ effect.setFloat(this.getRemappedName("intensity"), this._intensity.value);
82
+ }
83
+ }
84
+
85
+ /**
86
+ * A simple block to desaturate the input texture.
87
+ */
88
+ export class DesaturateBlock extends DisableableShaderBlock {
89
+ /**
90
+ * The class name of the block.
91
+ */
92
+ public static override ClassName = desaturateBlockType;
93
+
94
+ /**
95
+ * The namespace of the block.
96
+ */
97
+ public static override Namespace = babylonDemoEffectsNamespace;
98
+
99
+ /**
100
+ * The input texture connection point.
101
+ */
102
+ public readonly input = this._registerInput("input", ConnectionPointType.Texture);
103
+
104
+ /**
105
+ * The intensity connection point.
106
+ */
107
+ public readonly intensity = this._registerOptionalInput(
108
+ "intensity",
109
+ ConnectionPointType.Float,
110
+ createStrongRef(0.3)
111
+ );
112
+
113
+ /**
114
+ * The shader program (vertex and fragment code) to use to render the block
115
+ */
116
+ public static override ShaderCode = shaderProgram;
117
+
118
+ /**
119
+ * Instantiates a new Block.
120
+ * @param smartFilter - The smart filter this block belongs to
121
+ * @param name - The friendly name of the block
122
+ */
123
+ constructor(smartFilter: SmartFilter, name: string) {
124
+ super(smartFilter, name);
125
+ }
126
+
127
+ /**
128
+ * Get the class instance that binds all the required data to the shader (effect) when rendering.
129
+ * @returns The class instance that binds the data to the effect
130
+ */
131
+ public getShaderBinding(): DisableableShaderBinding {
132
+ const input = this._confirmRuntimeDataSupplied(this.input);
133
+ const intensity = this.intensity.runtimeData;
134
+
135
+ return new DesaturateShaderBinding(this, input, intensity);
136
+ }
137
+ }
@@ -0,0 +1,47 @@
1
+ import type { ISerializedBlockV1 } from "../../../../serialization/index.js";
2
+ import type { SmartFilter } from "../../../../smartFilter.js";
3
+ import { DirectionalBlurBlock } from "./directionalBlurBlock.js";
4
+
5
+ /**
6
+ * The definition of the extra data serialized for directional blur blocks.
7
+ */
8
+ export interface ISerializedDirectionalBlurBlockV1 extends ISerializedBlockV1 {
9
+ /**
10
+ * The extra data of the block.
11
+ */
12
+ data: {
13
+ /**
14
+ * The horizontal width of the blur.
15
+ */
16
+ blurHorizontalWidth: number;
17
+
18
+ /**
19
+ * The vertical width of the blur.
20
+ */
21
+ blurVerticalWidth: number;
22
+
23
+ /**
24
+ * The blur texture ratio.
25
+ */
26
+ blurTextureRatio: number;
27
+ };
28
+ }
29
+
30
+ /**
31
+ * V1 Directional Blur Deserializer.
32
+ * @param smartFilter - The SmartFilter to deserialize the block into
33
+ * @param serializedBlock - The serialized block data
34
+ * @returns A deserialized DirectionalBlurBlock
35
+ */
36
+ export function directionalBlurDeserializer(
37
+ smartFilter: SmartFilter,
38
+ serializedBlock: ISerializedDirectionalBlurBlockV1
39
+ ) {
40
+ const block = new DirectionalBlurBlock(smartFilter, serializedBlock.name);
41
+
42
+ // If data is missing, use the default value set by the block
43
+ block.blurHorizontalWidth = serializedBlock.data.blurHorizontalWidth ?? block.blurHorizontalWidth;
44
+ block.blurVerticalWidth = serializedBlock.data.blurVerticalWidth ?? block.blurVerticalWidth;
45
+ block.blurTextureRatio = serializedBlock.data.blurTextureRatio ?? block.blurTextureRatio;
46
+ return block;
47
+ }
@@ -0,0 +1,31 @@
1
+ import type { BaseBlock } from "../../../../blockFoundation";
2
+ import type { IBlockSerializerV1 } from "../../../../serialization";
3
+ import type { DirectionalBlurBlock } from "./directionalBlurBlock";
4
+ import { directionalBlurBlockType } from "../../../blockTypes.js";
5
+ import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
6
+
7
+ /**
8
+ * The V1 serializer for a Directional Blur Block
9
+ */
10
+ export const directionalBlurBlockSerializer: IBlockSerializerV1 = {
11
+ blockType: directionalBlurBlockType,
12
+ serialize: (block: BaseBlock) => {
13
+ if (block.getClassName() !== directionalBlurBlockType) {
14
+ throw new Error("Was asked to serialize an unrecognized block type");
15
+ }
16
+
17
+ const directionalBlurBlock = block as DirectionalBlurBlock;
18
+ return {
19
+ name: block.name,
20
+ uniqueId: block.uniqueId,
21
+ blockType: directionalBlurBlockType,
22
+ namespace: babylonDemoEffectsNamespace,
23
+ comments: block.comments,
24
+ data: {
25
+ blurTextureRatio: directionalBlurBlock.blurTextureRatio,
26
+ blurHorizontalWidth: directionalBlurBlock.blurHorizontalWidth,
27
+ blurVerticalWidth: directionalBlurBlock.blurVerticalWidth,
28
+ },
29
+ };
30
+ },
31
+ };
@@ -0,0 +1,193 @@
1
+ import type { Effect } from "@babylonjs/core/Materials/effect";
2
+
3
+ import { type RuntimeData } from "../../../../connection/connectionPoint.js";
4
+ import { ConnectionPointType } from "../../../../connection/connectionPointType.js";
5
+ import { ShaderBinding } from "../../../../runtime/shaderRuntime.js";
6
+ import type { ShaderProgram } from "../../../../utils/shaderCodeUtils.js";
7
+ import type { SmartFilter } from "../../../../smartFilter.js";
8
+ import { ShaderBlock } from "../../../../blockFoundation/shaderBlock.js";
9
+ import { editableInPropertyPage, PropertyTypeForEdition } from "../../../../editorUtils/editableInPropertyPage.js";
10
+
11
+ import { directionalBlurBlockType } from "../../../blockTypes.js";
12
+ import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
13
+
14
+ const shaderProgram: ShaderProgram = {
15
+ fragment: {
16
+ const: `
17
+ const float _epsilon_ = 0.01;
18
+ `,
19
+ uniform: `
20
+ uniform vec2 _texelStep_;
21
+ uniform sampler2D _input_;
22
+ `,
23
+
24
+ uniformSingle: `
25
+ uniform float[7] _weights_;
26
+ `,
27
+
28
+ mainFunctionName: "_directionalBlur_",
29
+
30
+ mainInputTexture: "_input_",
31
+
32
+ functions: [
33
+ {
34
+ name: "_directionalBlur_",
35
+ code: `
36
+ vec4 _directionalBlur_(vec2 vUV) {
37
+ vec2 start = vUV - 3.0 * _texelStep_;
38
+
39
+ vec4 finalWeightedColor = vec4(0., 0., 0., 0.);
40
+
41
+ for (int i = 0; i < 7; i++)
42
+ {
43
+ vec2 fetchUV = start + _texelStep_ * float(i);
44
+ fetchUV = clamp(fetchUV, 0., 1.);
45
+ vec4 colorSample = texture2D(_input_, fetchUV);
46
+
47
+ // Ignore samples from mostly transparent pixels
48
+ if (colorSample.a < _epsilon_) continue;
49
+
50
+ finalWeightedColor += colorSample * _weights_[i];
51
+ }
52
+
53
+ return finalWeightedColor;
54
+ }
55
+ `,
56
+ },
57
+ ],
58
+ },
59
+ };
60
+
61
+ const wideWeights = Float32Array.from([0.05, 0.1, 0.2, 0.3, 0.2, 0.1, 0.05]);
62
+
63
+ /**
64
+ * The shader bindings for the DirectionalBlur block.
65
+ */
66
+ export class DirectionalBlurShaderBinding extends ShaderBinding {
67
+ private readonly _inputTexture: RuntimeData<ConnectionPointType.Texture>;
68
+ private readonly _blurHorizontalWidth: number;
69
+ private readonly _blurVerticalWidth: number;
70
+
71
+ /**
72
+ * Creates a new shader binding instance for the DirectionalBlur block.
73
+ * @param inputTexture - The input texture
74
+ * @param blurHorizontalWidth - The horizontal blur width
75
+ * @param blurVerticalWidth - The vertical blur width
76
+ */
77
+ constructor(
78
+ inputTexture: RuntimeData<ConnectionPointType.Texture>,
79
+ blurHorizontalWidth: number,
80
+ blurVerticalWidth: number
81
+ ) {
82
+ super();
83
+ this._inputTexture = inputTexture;
84
+ this._blurHorizontalWidth = blurHorizontalWidth;
85
+ this._blurVerticalWidth = blurVerticalWidth;
86
+ }
87
+
88
+ /**
89
+ * Binds all the required data to the shader when rendering.
90
+ * @param effect - defines the effect to bind the data to
91
+ */
92
+ public override bind(effect: Effect): void {
93
+ // Global pass Setup
94
+ effect.setFloatArray(this.getRemappedName("weights"), wideWeights);
95
+
96
+ // V blur
97
+ effect.setTexture(this.getRemappedName("input"), this._inputTexture.value);
98
+
99
+ // Texel size
100
+ if (this._inputTexture.value) {
101
+ const inputSize = this._inputTexture.value.getSize();
102
+ const texelWidth = this._blurHorizontalWidth / inputSize.width;
103
+ const texelHeight = this._blurVerticalWidth / inputSize.height;
104
+ effect.setFloat2(this.getRemappedName("texelStep"), texelWidth, texelHeight);
105
+ }
106
+ }
107
+ }
108
+
109
+ /**
110
+ * A block performing a directional "gaussian" blur.
111
+ *
112
+ * It is aggregated as part of the @see BlurBlock.
113
+ */
114
+ export class DirectionalBlurBlock extends ShaderBlock {
115
+ /**
116
+ * The class name of the block.
117
+ */
118
+ public static override ClassName = directionalBlurBlockType;
119
+
120
+ /**
121
+ * The namespace of the block.
122
+ */
123
+ public static override Namespace = babylonDemoEffectsNamespace;
124
+
125
+ /**
126
+ * The input texture connection point.
127
+ */
128
+ public readonly input = this._registerInput("input", ConnectionPointType.Texture);
129
+
130
+ /**
131
+ * Defines how smaller we should make the target compared to the screen size.
132
+ */
133
+ @editableInPropertyPage("Texture Ratio", PropertyTypeForEdition.Float, "PROPERTIES", {
134
+ min: 0,
135
+ max: 1,
136
+ notifiers: { rebuild: true },
137
+ })
138
+ public blurTextureRatio = 0.5;
139
+
140
+ /**
141
+ * Defines the horizontal strength of the blur.
142
+ */
143
+ @editableInPropertyPage("Horizontal strength", PropertyTypeForEdition.Float, "PROPERTIES", {
144
+ min: 0,
145
+ max: 1,
146
+ notifiers: { rebuild: true },
147
+ })
148
+ public blurHorizontalWidth = 0;
149
+
150
+ /**
151
+ * Defines the vertical strength of the blur.
152
+ */
153
+ @editableInPropertyPage("Vertical strength", PropertyTypeForEdition.Float, "PROPERTIES", {
154
+ min: 0,
155
+ max: 1,
156
+ notifiers: { rebuild: true },
157
+ })
158
+ public blurVerticalWidth = 1;
159
+
160
+ /**
161
+ * The shader program (vertex and fragment code) to use to render the block
162
+ */
163
+ public static override ShaderCode = shaderProgram;
164
+
165
+ /**
166
+ * Instantiates a new Block.
167
+ * @param smartFilter - The smart filter this block belongs to
168
+ * @param name - The friendly name of the block
169
+ */
170
+ constructor(smartFilter: SmartFilter, name: string) {
171
+ super(smartFilter, name, true);
172
+ }
173
+
174
+ /**
175
+ * Prepares the block for runtime.
176
+ * This is called by the smart filter just before creating the smart filter runtime.
177
+ */
178
+ public override prepareForRuntime(): void {
179
+ super.prepareForRuntime();
180
+
181
+ this.outputTextureOptions.ratio = this.blurTextureRatio;
182
+ }
183
+
184
+ /**
185
+ * Get the class instance that binds all the required data to the shader (effect) when rendering.
186
+ * @returns The class instance that binds the data to the effect
187
+ */
188
+ public getShaderBinding(): ShaderBinding {
189
+ const input = this._confirmRuntimeDataSupplied(this.input);
190
+
191
+ return new DirectionalBlurShaderBinding(input, this.blurHorizontalWidth, this.blurVerticalWidth);
192
+ }
193
+ }
@@ -0,0 +1,120 @@
1
+ import type { Effect } from "@babylonjs/core/Materials/effect";
2
+
3
+ import { type RuntimeData } from "../../../../connection/connectionPoint.js";
4
+ import { ConnectionPointType } from "../../../../connection/connectionPointType.js";
5
+ import { type IDisableableBlock, DisableableShaderBlock } from "../../../../blockFoundation/disableableShaderBlock.js";
6
+ import { DisableableShaderBinding } from "../../../../runtime/shaderRuntime.js";
7
+ import type { ShaderProgram } from "../../../../utils/shaderCodeUtils.js";
8
+ import type { SmartFilter } from "../../../../smartFilter.js";
9
+
10
+ import { exposureBlockType } from "../../../blockTypes.js";
11
+ import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
12
+
13
+ const shaderProgram: ShaderProgram = {
14
+ fragment: {
15
+ uniform: `
16
+ uniform sampler2D _input_;
17
+ uniform float _amount_;
18
+ `,
19
+
20
+ mainFunctionName: "_exposure_",
21
+
22
+ mainInputTexture: "_input_",
23
+
24
+ functions: [
25
+ {
26
+ name: "_exposure_",
27
+ code: `
28
+ vec4 _exposure_(vec2 vUV) {
29
+ vec4 color = texture2D(_input_, vUV);
30
+ return vec4(color.rgb * _amount_, color.a);
31
+ }
32
+ `,
33
+ },
34
+ ],
35
+ },
36
+ };
37
+
38
+ /**
39
+ * The shader bindings for the ExposureBlock.
40
+ */
41
+ export class ExposureBinding extends DisableableShaderBinding {
42
+ private readonly _inputTexture: RuntimeData<ConnectionPointType.Texture>;
43
+ private readonly _amount: RuntimeData<ConnectionPointType.Float>;
44
+
45
+ /**
46
+ * Creates a new shader binding instance for the exposure block.
47
+ * @param parentBlock - The parent block
48
+ * @param inputTexture - The input texture
49
+ * @param amount - The exposure adjustment amount (1.0 means no adjustment)
50
+ */
51
+ constructor(
52
+ parentBlock: IDisableableBlock,
53
+ inputTexture: RuntimeData<ConnectionPointType.Texture>,
54
+ amount: RuntimeData<ConnectionPointType.Float>
55
+ ) {
56
+ super(parentBlock);
57
+ this._inputTexture = inputTexture;
58
+ this._amount = amount;
59
+ }
60
+
61
+ /**
62
+ * Binds all the required data to the shader when rendering.
63
+ * @param effect - defines the effect to bind the data to
64
+ */
65
+ public override bind(effect: Effect): void {
66
+ super.bind(effect);
67
+ effect.setTexture(this.getRemappedName("input"), this._inputTexture.value);
68
+ effect.setFloat(this.getRemappedName("amount"), this._amount.value);
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Applies an exposure adjustment to the input texture.
74
+ */
75
+ export class ExposureBlock extends DisableableShaderBlock {
76
+ /**
77
+ * The class name of the block.
78
+ */
79
+ public static override ClassName = exposureBlockType;
80
+
81
+ /**
82
+ * The namespace of the block.
83
+ */
84
+ public static override Namespace = babylonDemoEffectsNamespace;
85
+
86
+ /**
87
+ * The input texture connection point.
88
+ */
89
+ public readonly input = this._registerInput("input", ConnectionPointType.Texture);
90
+
91
+ /**
92
+ * The amount of exposure adjustment to apply (1.0 is no adjustment).
93
+ */
94
+ public readonly amount = this._registerInput("amount", ConnectionPointType.Float);
95
+
96
+ /**
97
+ * The shader program (vertex and fragment code) to use to render the block
98
+ */
99
+ public static override ShaderCode = shaderProgram;
100
+
101
+ /**
102
+ * Instantiates a new Block.
103
+ * @param smartFilter - The smart filter this block belongs to
104
+ * @param name - The friendly name of the block
105
+ */
106
+ constructor(smartFilter: SmartFilter, name: string) {
107
+ super(smartFilter, name);
108
+ }
109
+
110
+ /**
111
+ * Get the class instance that binds all the required data to the shader (effect) when rendering.
112
+ * @returns The class instance that binds the data to the effect
113
+ */
114
+ public getShaderBinding(): DisableableShaderBinding {
115
+ const input = this._confirmRuntimeDataSupplied(this.input);
116
+ const amount = this._confirmRuntimeDataSupplied(this.amount);
117
+
118
+ return new ExposureBinding(this, input, amount);
119
+ }
120
+ }
@@ -0,0 +1,152 @@
1
+ import type { Effect } from "@babylonjs/core/Materials/effect";
2
+
3
+ import { type RuntimeData } from "../../../../connection/connectionPoint.js";
4
+ import { ConnectionPointType } from "../../../../connection/connectionPointType.js";
5
+ import { type IDisableableBlock, DisableableShaderBlock } from "../../../../blockFoundation/disableableShaderBlock.js";
6
+ import { DisableableShaderBinding } from "../../../../runtime/shaderRuntime.js";
7
+ import type { ShaderProgram } from "../../../../utils/shaderCodeUtils.js";
8
+ import type { SmartFilter } from "../../../../smartFilter.js";
9
+ import { createStrongRef } from "../../../../runtime/strongRef.js";
10
+
11
+ import { greenScreenBlockType } from "../../../blockTypes.js";
12
+ import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
13
+
14
+ const shaderProgram: ShaderProgram = {
15
+ fragment: {
16
+ uniform: `
17
+ uniform sampler2D _input_;
18
+ uniform sampler2D _background_;
19
+ uniform vec3 _reference_;
20
+ uniform float _distance_;
21
+ `,
22
+
23
+ mainFunctionName: "_greenScreen_",
24
+
25
+ mainInputTexture: "_input_",
26
+
27
+ functions: [
28
+ {
29
+ name: "_greenScreen_",
30
+ code: `
31
+ vec4 _greenScreen_(vec2 vUV)
32
+ {
33
+ vec4 color = texture2D(_input_, vUV);
34
+ vec4 background = texture2D(_background_, vUV);
35
+
36
+ if (length(color.rgb - _reference_) < _distance_) {
37
+ return background;
38
+ }
39
+
40
+ return color;
41
+ }
42
+ `,
43
+ },
44
+ ],
45
+ },
46
+ };
47
+
48
+ /**
49
+ * The shader bindings for the Green block.
50
+ */
51
+ export class GreenShaderBinding extends DisableableShaderBinding {
52
+ private readonly _inputTexture: RuntimeData<ConnectionPointType.Texture>;
53
+ private readonly _backgroundTexture: RuntimeData<ConnectionPointType.Texture>;
54
+ private readonly _reference: RuntimeData<ConnectionPointType.Color3>;
55
+ private readonly _distance: RuntimeData<ConnectionPointType.Float>;
56
+
57
+ /**
58
+ * Creates a new shader binding instance for the Green block.
59
+ * @param parentBlock - The parent block
60
+ * @param inputTexture - the input texture
61
+ * @param backgroundTexture - the background texture
62
+ * @param reference - the reference color
63
+ * @param distance - the distance from the reference color
64
+ */
65
+ constructor(
66
+ parentBlock: IDisableableBlock,
67
+ inputTexture: RuntimeData<ConnectionPointType.Texture>,
68
+ backgroundTexture: RuntimeData<ConnectionPointType.Texture>,
69
+ reference: RuntimeData<ConnectionPointType.Color3>,
70
+ distance: RuntimeData<ConnectionPointType.Float>
71
+ ) {
72
+ super(parentBlock);
73
+ this._inputTexture = inputTexture;
74
+ this._backgroundTexture = backgroundTexture;
75
+ this._reference = reference;
76
+ this._distance = distance;
77
+ }
78
+
79
+ /**
80
+ * Binds all the required data to the shader when rendering.
81
+ * @param effect - defines the effect to bind the data to
82
+ */
83
+ public override bind(effect: Effect): void {
84
+ super.bind(effect);
85
+ effect.setTexture(this.getRemappedName("input"), this._inputTexture.value);
86
+ effect.setTexture(this.getRemappedName("background"), this._backgroundTexture.value);
87
+ effect.setColor3(this.getRemappedName("reference"), this._reference.value);
88
+ effect.setFloat(this.getRemappedName("distance"), this._distance.value);
89
+ }
90
+ }
91
+
92
+ /**
93
+ * A simple block to insert a background in place of a green screen.
94
+ */
95
+ export class GreenScreenBlock extends DisableableShaderBlock {
96
+ /**
97
+ * The class name of the block.
98
+ */
99
+ public static override ClassName = greenScreenBlockType;
100
+
101
+ /**
102
+ * The namespace of the block.
103
+ */
104
+ public static override Namespace = babylonDemoEffectsNamespace;
105
+
106
+ /**
107
+ * The input texture connection point.
108
+ */
109
+ public readonly input = this._registerInput("input", ConnectionPointType.Texture);
110
+
111
+ /**
112
+ * The background texture connection point.
113
+ */
114
+ public readonly background = this._registerInput("background", ConnectionPointType.Texture);
115
+
116
+ /**
117
+ * The reference color of the green screen.
118
+ */
119
+ public readonly reference = this._registerInput("reference", ConnectionPointType.Color3);
120
+
121
+ /**
122
+ * The "distance" from the color the reference is allowed to have for replacement.
123
+ */
124
+ public readonly distance = this._registerOptionalInput("distance", ConnectionPointType.Float, createStrongRef(0.1));
125
+
126
+ /**
127
+ * The shader program (vertex and fragment code) to use to render the block
128
+ */
129
+ public static override ShaderCode = shaderProgram;
130
+
131
+ /**
132
+ * Instantiates a new Block.
133
+ * @param smartFilter - The smart filter this block belongs to
134
+ * @param name - The friendly name of the block
135
+ */
136
+ constructor(smartFilter: SmartFilter, name: string) {
137
+ super(smartFilter, name);
138
+ }
139
+
140
+ /**
141
+ * Get the class instance that binds all the required data to the shader (effect) when rendering.
142
+ * @returns The class instance that binds the data to the effect
143
+ */
144
+ public getShaderBinding(): DisableableShaderBinding {
145
+ const input = this._confirmRuntimeDataSupplied(this.input);
146
+ const background = this._confirmRuntimeDataSupplied(this.background);
147
+ const reference = this._confirmRuntimeDataSupplied(this.reference);
148
+ const distance = this.distance.runtimeData;
149
+
150
+ return new GreenShaderBinding(this, input, background, reference, distance);
151
+ }
152
+ }
@@ -0,0 +1,14 @@
1
+ export * from "./blackAndWhiteBlock.js";
2
+ export * from "./blurBlock.js";
3
+ export * from "./compositionBlock.js";
4
+ export * from "./contrastBlock.js";
5
+ export * from "./desaturateBlock.js";
6
+ export * from "./directionalBlurBlock.js";
7
+ export * from "./exposureBlock.js";
8
+ export * from "./greenScreenBlock.js";
9
+ export * from "./kaleidoscopeBlock.js";
10
+ export * from "./maskBlock.js";
11
+ export * from "./pixelateBlock.js";
12
+ export * from "./posterizeBlock.js";
13
+ export * from "./spritesheetBlock.js";
14
+ export * from "./tintBlock.js";