@babylonjs/smart-filters 0.1.0-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 (138) hide show
  1. package/dist/IDisposable.d.ts +10 -0
  2. package/dist/IDisposable.d.ts.map +1 -0
  3. package/dist/IDisposable.js +2 -0
  4. package/dist/IDisposable.js.map +1 -0
  5. package/dist/blocks/aggregateBlock.d.ts +50 -0
  6. package/dist/blocks/aggregateBlock.d.ts.map +1 -0
  7. package/dist/blocks/aggregateBlock.js +103 -0
  8. package/dist/blocks/aggregateBlock.js.map +1 -0
  9. package/dist/blocks/baseBlock.d.ts +160 -0
  10. package/dist/blocks/baseBlock.d.ts.map +1 -0
  11. package/dist/blocks/baseBlock.js +256 -0
  12. package/dist/blocks/baseBlock.js.map +1 -0
  13. package/dist/blocks/copyBlock.d.ts +59 -0
  14. package/dist/blocks/copyBlock.d.ts.map +1 -0
  15. package/dist/blocks/copyBlock.js +84 -0
  16. package/dist/blocks/copyBlock.js.map +1 -0
  17. package/dist/blocks/disableableBlock.d.ts +30 -0
  18. package/dist/blocks/disableableBlock.d.ts.map +1 -0
  19. package/dist/blocks/disableableBlock.js +22 -0
  20. package/dist/blocks/disableableBlock.js.map +1 -0
  21. package/dist/blocks/inputBlock.d.ts +64 -0
  22. package/dist/blocks/inputBlock.d.ts.map +1 -0
  23. package/dist/blocks/inputBlock.js +74 -0
  24. package/dist/blocks/inputBlock.js.map +1 -0
  25. package/dist/blocks/outputBlock.d.ts +42 -0
  26. package/dist/blocks/outputBlock.d.ts.map +1 -0
  27. package/dist/blocks/outputBlock.js +74 -0
  28. package/dist/blocks/outputBlock.js.map +1 -0
  29. package/dist/blocks/shaderBlock.d.ts +68 -0
  30. package/dist/blocks/shaderBlock.d.ts.map +1 -0
  31. package/dist/blocks/shaderBlock.js +101 -0
  32. package/dist/blocks/shaderBlock.js.map +1 -0
  33. package/dist/command/command.d.ts +49 -0
  34. package/dist/command/command.d.ts.map +1 -0
  35. package/dist/command/command.js +15 -0
  36. package/dist/command/command.js.map +1 -0
  37. package/dist/command/commandBuffer.d.ts +40 -0
  38. package/dist/command/commandBuffer.d.ts.map +1 -0
  39. package/dist/command/commandBuffer.js +58 -0
  40. package/dist/command/commandBuffer.js.map +1 -0
  41. package/dist/command/commandBufferDebugger.d.ts +7 -0
  42. package/dist/command/commandBufferDebugger.d.ts.map +1 -0
  43. package/dist/command/commandBufferDebugger.js +12 -0
  44. package/dist/command/commandBufferDebugger.js.map +1 -0
  45. package/dist/connection/connectionPoint.d.ts +110 -0
  46. package/dist/connection/connectionPoint.d.ts.map +1 -0
  47. package/dist/connection/connectionPoint.js +153 -0
  48. package/dist/connection/connectionPoint.js.map +1 -0
  49. package/dist/connection/connectionPointCompatibilityState.d.ts +20 -0
  50. package/dist/connection/connectionPointCompatibilityState.d.ts.map +1 -0
  51. package/dist/connection/connectionPointCompatibilityState.js +32 -0
  52. package/dist/connection/connectionPointCompatibilityState.js.map +1 -0
  53. package/dist/connection/connectionPointDirection.d.ts +10 -0
  54. package/dist/connection/connectionPointDirection.d.ts.map +1 -0
  55. package/dist/connection/connectionPointDirection.js +11 -0
  56. package/dist/connection/connectionPointDirection.js.map +1 -0
  57. package/dist/connection/connectionPointType.d.ts +22 -0
  58. package/dist/connection/connectionPointType.d.ts.map +1 -0
  59. package/dist/connection/connectionPointType.js +17 -0
  60. package/dist/connection/connectionPointType.js.map +1 -0
  61. package/dist/connection/connectionPointWithDefault.d.ts +23 -0
  62. package/dist/connection/connectionPointWithDefault.d.ts.map +1 -0
  63. package/dist/connection/connectionPointWithDefault.js +19 -0
  64. package/dist/connection/connectionPointWithDefault.js.map +1 -0
  65. package/dist/index.d.ts +28 -0
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/index.js +28 -0
  68. package/dist/index.js.map +1 -0
  69. package/dist/optimization/dependencyGraph.d.ts +31 -0
  70. package/dist/optimization/dependencyGraph.d.ts.map +1 -0
  71. package/dist/optimization/dependencyGraph.js +77 -0
  72. package/dist/optimization/dependencyGraph.js.map +1 -0
  73. package/dist/optimization/optimizedShaderBlock.d.ts +75 -0
  74. package/dist/optimization/optimizedShaderBlock.d.ts.map +1 -0
  75. package/dist/optimization/optimizedShaderBlock.js +105 -0
  76. package/dist/optimization/optimizedShaderBlock.js.map +1 -0
  77. package/dist/optimization/smartFilterOptimizer.d.ts +72 -0
  78. package/dist/optimization/smartFilterOptimizer.d.ts.map +1 -0
  79. package/dist/optimization/smartFilterOptimizer.js +482 -0
  80. package/dist/optimization/smartFilterOptimizer.js.map +1 -0
  81. package/dist/runtime/renderTargetGenerator.d.ts +35 -0
  82. package/dist/runtime/renderTargetGenerator.d.ts.map +1 -0
  83. package/dist/runtime/renderTargetGenerator.js +153 -0
  84. package/dist/runtime/renderTargetGenerator.js.map +1 -0
  85. package/dist/runtime/shaderRuntime.d.ts +95 -0
  86. package/dist/runtime/shaderRuntime.d.ts.map +1 -0
  87. package/dist/runtime/shaderRuntime.js +120 -0
  88. package/dist/runtime/shaderRuntime.js.map +1 -0
  89. package/dist/runtime/smartFilterRuntime.d.ts +69 -0
  90. package/dist/runtime/smartFilterRuntime.d.ts.map +1 -0
  91. package/dist/runtime/smartFilterRuntime.js +57 -0
  92. package/dist/runtime/smartFilterRuntime.js.map +1 -0
  93. package/dist/runtime/strongRef.d.ts +16 -0
  94. package/dist/runtime/strongRef.d.ts.map +1 -0
  95. package/dist/runtime/strongRef.js +9 -0
  96. package/dist/runtime/strongRef.js.map +1 -0
  97. package/dist/smartFilter.d.ts +100 -0
  98. package/dist/smartFilter.d.ts.map +1 -0
  99. package/dist/smartFilter.js +154 -0
  100. package/dist/smartFilter.js.map +1 -0
  101. package/dist/utils/shaderCodeUtils.d.ts +131 -0
  102. package/dist/utils/shaderCodeUtils.d.ts.map +1 -0
  103. package/dist/utils/shaderCodeUtils.js +115 -0
  104. package/dist/utils/shaderCodeUtils.js.map +1 -0
  105. package/dist/utils/textureLoaders.d.ts +14 -0
  106. package/dist/utils/textureLoaders.d.ts.map +1 -0
  107. package/dist/utils/textureLoaders.js +22 -0
  108. package/dist/utils/textureLoaders.js.map +1 -0
  109. package/license.md +21 -0
  110. package/package.json +47 -0
  111. package/readme.md +165 -0
  112. package/src/IDisposable.ts +9 -0
  113. package/src/blocks/aggregateBlock.ts +121 -0
  114. package/src/blocks/baseBlock.ts +341 -0
  115. package/src/blocks/copyBlock.ts +103 -0
  116. package/src/blocks/disableableBlock.ts +40 -0
  117. package/src/blocks/inputBlock.ts +114 -0
  118. package/src/blocks/outputBlock.ts +97 -0
  119. package/src/blocks/shaderBlock.ts +145 -0
  120. package/src/command/command.ts +60 -0
  121. package/src/command/commandBuffer.ts +71 -0
  122. package/src/command/commandBufferDebugger.ts +13 -0
  123. package/src/connection/connectionPoint.ts +212 -0
  124. package/src/connection/connectionPointCompatibilityState.ts +31 -0
  125. package/src/connection/connectionPointDirection.ts +9 -0
  126. package/src/connection/connectionPointType.ts +30 -0
  127. package/src/connection/connectionPointWithDefault.ts +35 -0
  128. package/src/index.ts +36 -0
  129. package/src/optimization/dependencyGraph.ts +94 -0
  130. package/src/optimization/optimizedShaderBlock.ts +133 -0
  131. package/src/optimization/smartFilterOptimizer.ts +706 -0
  132. package/src/runtime/renderTargetGenerator.ts +204 -0
  133. package/src/runtime/shaderRuntime.ts +155 -0
  134. package/src/runtime/smartFilterRuntime.ts +104 -0
  135. package/src/runtime/strongRef.ts +18 -0
  136. package/src/smartFilter.ts +227 -0
  137. package/src/utils/shaderCodeUtils.ts +242 -0
  138. package/src/utils/textureLoaders.ts +28 -0
@@ -0,0 +1,154 @@
1
+ import { OutputBlock } from "./blocks/outputBlock.js";
2
+ import { InternalSmartFilterRuntime } from "./runtime/smartFilterRuntime.js";
3
+ import { RenderTargetGenerator } from "./runtime/renderTargetGenerator.js";
4
+ import { AggregateBlock } from "./blocks/aggregateBlock.js";
5
+ /**
6
+ * How long to wait for shader compilation and texture loading to complete before erroring out.
7
+ */
8
+ const InitializationTimeout = 10000;
9
+ /**
10
+ * The smart filter class is the main class of the smart filter module.
11
+ *
12
+ * It is responsible for managing a graph of smart filter blocks.
13
+ *
14
+ * It is also responsible for creating the runtime associated to the current state of the filter.
15
+ */
16
+ export class SmartFilter {
17
+ /**
18
+ * Creates a new instance of a @see SmartFilter.
19
+ * @param name - The friendly name of the smart filter
20
+ */
21
+ constructor(name) {
22
+ /**
23
+ * User defined comments to describe the current smart filter.
24
+ */
25
+ this.comments = null;
26
+ /**
27
+ * Data used by the smart filter editor.
28
+ * TODO. strong type and hide this.
29
+ */
30
+ this.editorData = null;
31
+ this.name = name;
32
+ this._attachedBlocks = new Array();
33
+ this._outputBlock = new OutputBlock(this);
34
+ this.output = this._outputBlock.input;
35
+ }
36
+ /**
37
+ * @returns the list of blocks attached to the smart filter.
38
+ */
39
+ get attachedBlocks() {
40
+ return this._attachedBlocks;
41
+ }
42
+ /**
43
+ * @returns The current class name of the smart filter.
44
+ */
45
+ getClassName() {
46
+ return "SmartFilter";
47
+ }
48
+ /**
49
+ * Registers a block to be part of this smart filter.
50
+ * @param block - The block to register on the smart filter
51
+ * @throws if the block is already registered on another smart filter
52
+ * @remarks This function will not register the block if it is already registered on the smart filter.
53
+ */
54
+ registerBlock(block) {
55
+ // It is impossible to attach a block from another filter
56
+ if (block.smartFilter !== this) {
57
+ throw new Error("Block is not part of this smart filter");
58
+ }
59
+ // No need to attach a block several times
60
+ if (this._attachedBlocks.indexOf(block) !== -1) {
61
+ return;
62
+ }
63
+ // Add the block to the list of attached blocks
64
+ this._attachedBlocks.push(block);
65
+ }
66
+ /**
67
+ * Removes the block from the smart filter.
68
+ * @param block - The block to remove from the smart filter
69
+ * @remarks This function will disconnect the block on removal.
70
+ * This Output block cannot be removed.
71
+ */
72
+ removeBlock(block) {
73
+ const attachedBlockIndex = this._attachedBlocks.indexOf(block);
74
+ // The block can only be removed if it is not the output block
75
+ // and if it is attached to the smart filter
76
+ if (attachedBlockIndex > -1 && !block.isOutput) {
77
+ // Disconnects all the connections of the block
78
+ block.disconnect();
79
+ // Removes the block from the list of attached blocks
80
+ this._attachedBlocks.splice(attachedBlockIndex, 1);
81
+ }
82
+ }
83
+ _generateCommandsAndGatherInitPromises(initializationData) {
84
+ const outputBlock = this._outputBlock;
85
+ outputBlock.visit(initializationData, (block, initializationData) => {
86
+ var _a, _b;
87
+ // If the block is the output block,
88
+ if (block === outputBlock) {
89
+ // We only need to do something if the connected block is an input block.
90
+ // Indeed, any other block linked to the output block would directly render to the canvas
91
+ // as an optimization.
92
+ // In case the output block is not linked to an input block, we do not need extra commands
93
+ // or resources to create a render pass.
94
+ if ((_a = outputBlock.input.connectedTo) === null || _a === void 0 ? void 0 : _a.ownerBlock.isInput) {
95
+ block.generateCommandsAndGatherInitPromises(initializationData, true);
96
+ }
97
+ return;
98
+ }
99
+ block.generateCommandsAndGatherInitPromises(initializationData, ((_b = outputBlock.input.connectedTo) === null || _b === void 0 ? void 0 : _b.ownerBlock) === block);
100
+ });
101
+ }
102
+ /**
103
+ * Create a new runtime for the current state of the smart filter.
104
+ * @param engine - The Babylon.js engine to use for the runtime
105
+ * @param renderTargetGenerator - The render target generator to use to generate the RTTs for the shader blocks. If not provided, a default one will be created.
106
+ * @returns the runtime that can be used to render the smart filter
107
+ */
108
+ async createRuntimeAsync(engine, renderTargetGenerator) {
109
+ const runtime = new InternalSmartFilterRuntime(engine);
110
+ const initializationData = {
111
+ runtime,
112
+ outputBlock: this._outputBlock,
113
+ initializationPromises: [],
114
+ };
115
+ this._workWithAggregateFreeGraph(() => {
116
+ this._outputBlock.prepareForRuntime();
117
+ renderTargetGenerator = renderTargetGenerator !== null && renderTargetGenerator !== void 0 ? renderTargetGenerator : new RenderTargetGenerator(false);
118
+ renderTargetGenerator.setOutputTextures(this, initializationData);
119
+ this._outputBlock.propagateRuntimeData();
120
+ this._generateCommandsAndGatherInitPromises(initializationData);
121
+ });
122
+ // Wait for all the blocks to be initialized
123
+ if (initializationData.initializationPromises.length > 0) {
124
+ const timeoutPromise = new Promise((resolve) => setTimeout(resolve, InitializationTimeout, true));
125
+ const initializationPromises = Promise.all(initializationData.initializationPromises).then(() => false);
126
+ const timedOut = await Promise.race([initializationPromises, timeoutPromise]);
127
+ if (timedOut) {
128
+ throw new Error("Initialization promises timed out");
129
+ }
130
+ }
131
+ return runtime;
132
+ }
133
+ /**
134
+ * @internal
135
+ * Merges all aggregate blocks into the smart filter graph, executes the passed-in work, then restores the aggregate blocks.
136
+ * @param work - The work to execute with the aggregate blocks merged
137
+ */
138
+ _workWithAggregateFreeGraph(work) {
139
+ const mergedAggregateBlocks = [];
140
+ // Merge all aggregate blocks
141
+ this._outputBlock.visit({}, (block, _extraData) => {
142
+ if (block instanceof AggregateBlock) {
143
+ block._mergeIntoSmartFilter(mergedAggregateBlocks);
144
+ }
145
+ });
146
+ // Do the passed in work
147
+ work();
148
+ // Restore all aggregate blocks
149
+ for (const block of mergedAggregateBlocks) {
150
+ block._unmergeFromSmartFilter();
151
+ }
152
+ }
153
+ }
154
+ //# sourceMappingURL=smartFilter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smartFilter.js","sourceRoot":"","sources":["../src/smartFilter.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;GAEG;AACH,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAsBpC;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IA2BpB;;;OAGG;IACH,YAAY,IAAY;QAlBxB;;WAEG;QACI,aAAQ,GAAqB,IAAI,CAAC;QAEzC;;;WAGG;QACI,eAAU,GAAQ,IAAI,CAAC;QAU1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,CAAC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AAM,GAAG,CAAC,EAAE,CAAC;YACvD,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,CAAC,CAAC,CAAC;YAClG,MAAM,sBAAsB,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;YACxG,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC,CAAC;YAC9E,IAAI,QAAQ,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACzD,CAAC;QACL,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACI,2BAA2B,CAAC,IAAgB;QAC/C,MAAM,qBAAqB,GAAqB,EAAE,CAAC;QAEnD,6BAA6B;QAC7B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAgB,EAAE,UAAkB,EAAE,EAAE;YACjE,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;gBAClC,KAAK,CAAC,qBAAqB,CAAC,qBAAqB,CAAC,CAAC;YACvD,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,wBAAwB;QACxB,IAAI,EAAE,CAAC;QAEP,+BAA+B;QAC/B,KAAK,MAAM,KAAK,IAAI,qBAAqB,EAAE,CAAC;YACxC,KAAK,CAAC,uBAAuB,EAAE,CAAC;QACpC,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,131 @@
1
+ import type { Effect } from "@babylonjs/core/Materials/effect";
2
+ /**
3
+ * The shader code decorator.
4
+ * Used to decorate the names of uniform, function and const variables for easier parsing.
5
+ */
6
+ export declare const decorateChar = "_";
7
+ /**
8
+ * Describes a shader function.
9
+ */
10
+ export type ShaderFunction = {
11
+ /**
12
+ * The name of the function.
13
+ */
14
+ name: string;
15
+ /**
16
+ * The code of the function.
17
+ */
18
+ code: string;
19
+ };
20
+ /**
21
+ * Describes a shader code.
22
+ */
23
+ export type ShaderCode = {
24
+ /**
25
+ * The declaration of the const variables.
26
+ */
27
+ const?: string;
28
+ /**
29
+ * The declaration of the uniform variables.
30
+ */
31
+ uniform?: string;
32
+ /**
33
+ * The declaration of the uniform variables that should be common for all ShaderBlock instances using this shader code.
34
+ */
35
+ uniformSingle?: string;
36
+ /**
37
+ * The name of the main function.
38
+ */
39
+ mainFunctionName: string;
40
+ /**
41
+ * The name of the main input texture.
42
+ */
43
+ mainInputTexture?: string;
44
+ /**
45
+ * The list of functions used in the shader.
46
+ */
47
+ functions: ShaderFunction[];
48
+ };
49
+ /**
50
+ * Describes a shader program.
51
+ */
52
+ export type ShaderProgram = {
53
+ /**
54
+ * The vertex shader code.
55
+ */
56
+ vertex?: string | undefined;
57
+ /**
58
+ * The fragment shader code.
59
+ */
60
+ fragment: ShaderCode;
61
+ };
62
+ /**
63
+ * The list of options required to create a shader block.
64
+ * It mainly contains the shader code to execute and its associated parameters.
65
+ */
66
+ export type ShaderCreationOptions = {
67
+ /**
68
+ * A friendly name for the shader visible in Spector or in logs.
69
+ */
70
+ name: string;
71
+ /**
72
+ * Fragment shader source code.
73
+ */
74
+ fragmentShader: string;
75
+ /**
76
+ * Vertex shader source code.
77
+ */
78
+ vertexShader?: string;
79
+ /**
80
+ * Attributes to use in the shader
81
+ */
82
+ attributeNames?: Array<string>;
83
+ /**
84
+ * Uniforms to use in the shader
85
+ */
86
+ uniformNames?: Array<string>;
87
+ /**
88
+ * Texture sampler names to use in the shader
89
+ */
90
+ samplerNames?: Array<string>;
91
+ /**
92
+ * Defines to use in the shader
93
+ */
94
+ defines?: Array<string>;
95
+ /**
96
+ * Callback when the effect is compiled
97
+ */
98
+ onCompiled?: (effect: Effect) => void;
99
+ };
100
+ /**
101
+ * Injects the disable uniform into a shader program.
102
+ * @param shaderProgram - The shader program to inject the disable uniform into.
103
+ * @returns The modified shader program
104
+ */
105
+ export declare function injectDisableUniform(shaderProgram: ShaderProgram): ShaderProgram;
106
+ /**
107
+ * Gets the shader fragment code.
108
+ * @param shaderProgram - The shader program to extract the code from.
109
+ * @param mainCodeOnly - If true, only the main function code will be returned.
110
+ * @returns The shader fragment code.
111
+ */
112
+ export declare function getShaderFragmentCode(shaderProgram: ShaderProgram, mainCodeOnly?: boolean): string;
113
+ /**
114
+ * Gets the shader creation options from a shader program.
115
+ * @param shaderProgram - The shader program to build the create options from.
116
+ * @returns The shader creation options.
117
+ */
118
+ export declare function getShaderCreateOptions(shaderProgram: ShaderProgram): ShaderCreationOptions;
119
+ /**
120
+ * Decorates a symbol (uniform, function or const) name.
121
+ * @param symbol - The symbol to decorate.
122
+ * @returns The decorated symbol.
123
+ */
124
+ export declare function decorateSymbol(symbol: string): string;
125
+ /**
126
+ * Undecorates a symbol (uniform, function or const) name.
127
+ * @param symbol - The symbol to undecorate.
128
+ * @returns The undecorated symbol. Throws an error if the symbol is not decorated.
129
+ */
130
+ export declare function undecorateSymbol(symbol: string): string;
131
+ //# sourceMappingURL=shaderCodeUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shaderCodeUtils.d.ts","sourceRoot":"","sources":["../../src/utils/shaderCodeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,C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,CAErD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMvD"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * The shader code decorator.
3
+ * Used to decorate the names of uniform, function and const variables for easier parsing.
4
+ */
5
+ export const decorateChar = "_";
6
+ /**
7
+ * Injects the disable uniform into a shader program.
8
+ * @param shaderProgram - The shader program to inject the disable uniform into.
9
+ * @returns The modified shader program
10
+ */
11
+ export function injectDisableUniform(shaderProgram) {
12
+ const shaderFragment = shaderProgram.fragment;
13
+ shaderFragment.uniform += "\nuniform bool _disabled_;";
14
+ for (let i = 0; i < shaderFragment.functions.length; ++i) {
15
+ const func = shaderFragment.functions[i];
16
+ if (func.name === shaderFragment.mainFunctionName) {
17
+ func.code = func.code.replace("{", `{\n if (_disabled_) return texture2D(${shaderProgram.fragment.mainInputTexture}, vUV);\n`);
18
+ break;
19
+ }
20
+ }
21
+ return shaderProgram;
22
+ }
23
+ /**
24
+ * Gets the shader fragment code.
25
+ * @param shaderProgram - The shader program to extract the code from.
26
+ * @param mainCodeOnly - If true, only the main function code will be returned.
27
+ * @returns The shader fragment code.
28
+ */
29
+ export function getShaderFragmentCode(shaderProgram, mainCodeOnly = false) {
30
+ var _a, _b;
31
+ const shaderFragment = shaderProgram.fragment;
32
+ const declarations = ((_a = shaderFragment.const) !== null && _a !== void 0 ? _a : "") +
33
+ "\n" +
34
+ shaderFragment.uniform +
35
+ "\n" +
36
+ ((_b = shaderFragment.uniformSingle) !== null && _b !== void 0 ? _b : "") +
37
+ "\n";
38
+ let mainFunctionCode = "";
39
+ let otherFunctionsCode = "";
40
+ for (let i = 0; i < shaderFragment.functions.length; ++i) {
41
+ const func = shaderFragment.functions[i];
42
+ if (func.name === shaderFragment.mainFunctionName) {
43
+ mainFunctionCode += func.code + "\n";
44
+ if (mainCodeOnly) {
45
+ break;
46
+ }
47
+ }
48
+ else {
49
+ otherFunctionsCode += func.code + "\n";
50
+ }
51
+ }
52
+ return mainCodeOnly ? mainFunctionCode : declarations + otherFunctionsCode + mainFunctionCode;
53
+ }
54
+ /**
55
+ * Gets the shader creation options from a shader program.
56
+ * @param shaderProgram - The shader program to build the create options from.
57
+ * @returns The shader creation options.
58
+ */
59
+ export function getShaderCreateOptions(shaderProgram) {
60
+ var _a;
61
+ const shaderFragment = shaderProgram.fragment;
62
+ let code = getShaderFragmentCode(shaderProgram);
63
+ const uniforms = shaderFragment.uniform + "\n" + ((_a = shaderFragment.uniformSingle) !== null && _a !== void 0 ? _a : "");
64
+ const uniformNames = [];
65
+ const samplerNames = [];
66
+ const rx = new RegExp(`uniform\\s+(\\S+)\\s+(\\w+)\\s*;`, "g");
67
+ let match = rx.exec(uniforms);
68
+ while (match !== null) {
69
+ const varType = match[1];
70
+ const varName = match[2];
71
+ if (varType === "sampler2D" || varType === "sampler3D") {
72
+ samplerNames.push(varName);
73
+ }
74
+ else {
75
+ uniformNames.push(varName);
76
+ }
77
+ match = rx.exec(uniforms);
78
+ }
79
+ code =
80
+ "varying vec2 vUV;\n" +
81
+ code +
82
+ "\nvoid main(void) {\ngl_FragColor = " +
83
+ shaderFragment.mainFunctionName +
84
+ "(vUV);\n}";
85
+ const options = {
86
+ name: shaderFragment.mainFunctionName,
87
+ fragmentShader: code,
88
+ uniformNames: uniformNames,
89
+ samplerNames: samplerNames,
90
+ };
91
+ if (shaderProgram.vertex) {
92
+ options.vertexShader = shaderProgram.vertex;
93
+ }
94
+ return options;
95
+ }
96
+ /**
97
+ * Decorates a symbol (uniform, function or const) name.
98
+ * @param symbol - The symbol to decorate.
99
+ * @returns The decorated symbol.
100
+ */
101
+ export function decorateSymbol(symbol) {
102
+ return decorateChar + symbol + decorateChar;
103
+ }
104
+ /**
105
+ * Undecorates a symbol (uniform, function or const) name.
106
+ * @param symbol - The symbol to undecorate.
107
+ * @returns The undecorated symbol. Throws an error if the symbol is not decorated.
108
+ */
109
+ export function undecorateSymbol(symbol) {
110
+ if (symbol.charAt(0) !== decorateChar || symbol.charAt(symbol.length - 1) !== decorateChar) {
111
+ throw new Error(`undecorateSymbol: Invalid symbol name "${symbol}"`);
112
+ }
113
+ return symbol.substring(1, symbol.length - 1);
114
+ }
115
+ //# sourceMappingURL=shaderCodeUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shaderCodeUtils.js","sourceRoot":"","sources":["../../src/utils/shaderCodeUtils.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AA0GhC;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,aAA4B;IAC7D,MAAM,cAAc,GAAG,aAAa,CAAC,QAAQ,CAAC;IAE9C,cAAc,CAAC,OAAO,IAAI,4BAA4B,CAAC;IAEvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC,CAAE,CAAC;QAC1C,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;YAChD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CACzB,GAAG,EACH,2CAA2C,aAAa,CAAC,QAAQ,CAAC,gBAAgB,WAAW,CAChG,CAAC;YACF,MAAM;QACV,CAAC;IACL,CAAC;IAED,OAAO,aAAa,CAAC;AACzB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,aAA4B,EAAE,YAAY,GAAG,KAAK;;IACpF,MAAM,cAAc,GAAG,aAAa,CAAC,QAAQ,CAAC;IAE9C,MAAM,YAAY,GACd,CAAC,MAAA,cAAc,CAAC,KAAK,mCAAI,EAAE,CAAC;QAC5B,IAAI;QACJ,cAAc,CAAC,OAAO;QACtB,IAAI;QACJ,CAAC,MAAA,cAAc,CAAC,aAAa,mCAAI,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,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { ThinTexture } from "@babylonjs/core/Materials/Textures/thinTexture.js";
2
+ import { type ThinEngine } from "@babylonjs/core/Engines/thinEngine.js";
3
+ /**
4
+ * Helper that takes in a URL to an image and returns a ThinTexture
5
+ * @param engine - defines the engine to use to create the texture
6
+ * @param url - defines a value which contains one of the following:
7
+ * * A conventional http URL, e.g. 'http://...' or 'file://...'
8
+ * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
9
+ * @param flipY - Indicates if the Y axis should be flipped
10
+ * @param samplingMode - The sampling mode to use
11
+ * @returns A ThinTexture of the image
12
+ */
13
+ export declare function createImageTexture(engine: ThinEngine, url: string, flipY?: boolean, samplingMode?: number | undefined): ThinTexture;
14
+ //# sourceMappingURL=textureLoaders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textureLoaders.d.ts","sourceRoot":"","sources":["../../src/utils/textureLoaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAChF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAExE;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAC9B,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,OAAc,EACrB,YAAY,GAAE,MAAM,GAAG,SAAqB,GAC7C,WAAW,CAGb"}
@@ -0,0 +1,22 @@
1
+ import { ThinTexture } from "@babylonjs/core/Materials/Textures/thinTexture.js";
2
+ import {} from "@babylonjs/core/Engines/thinEngine.js";
3
+ /**
4
+ * Helper that takes in a URL to an image and returns a ThinTexture
5
+ * @param engine - defines the engine to use to create the texture
6
+ * @param url - defines a value which contains one of the following:
7
+ * * A conventional http URL, e.g. 'http://...' or 'file://...'
8
+ * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'
9
+ * @param flipY - Indicates if the Y axis should be flipped
10
+ * @param samplingMode - The sampling mode to use
11
+ * @returns A ThinTexture of the image
12
+ */
13
+ export function createImageTexture(engine, url, flipY = true, samplingMode = undefined) {
14
+ const internalTexture = engine.createTexture(url, true, flipY, null, samplingMode);
15
+ return new ThinTexture(internalTexture);
16
+ }
17
+ /*
18
+ Future util ideas:
19
+ HtmlElementTexture
20
+ WebCamTexture
21
+ */
22
+ //# sourceMappingURL=textureLoaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textureLoaders.js","sourceRoot":"","sources":["../../src/utils/textureLoaders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AAChF,OAAO,EAAmB,MAAM,uCAAuC,CAAC;AAExE;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAC9B,MAAkB,EAClB,GAAW,EACX,QAAiB,IAAI,EACrB,eAAmC,SAAS;IAE5C,MAAM,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IACnF,OAAO,IAAI,WAAW,CAAC,eAAe,CAAC,CAAC;AAC5C,CAAC;AAED;;;;EAIE"}
package/license.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Babylon.js
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@babylonjs/smart-filters",
3
+ "version": "0.1.0-alpha",
4
+ "description": "Babylon.js Smart Filter core and common block library",
5
+ "author": {
6
+ "name": "Sebastien VANDENBERGHE"
7
+ },
8
+ "keywords": [
9
+ "video",
10
+ "composition",
11
+ "3D",
12
+ "2D",
13
+ "javascript",
14
+ "html5",
15
+ "webgl",
16
+ "webgl2",
17
+ "webgpu",
18
+ "babylon"
19
+ ],
20
+ "license": "MIT",
21
+ "readme": "README.md",
22
+ "main": "dist/index",
23
+ "module": "dist/index",
24
+ "esnext": "dist/index",
25
+ "types": "dist/index",
26
+ "type": "module",
27
+ "sideEffects": false,
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/BabylonJS/SmartFilters.git"
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "src",
35
+ "license.md",
36
+ "readme.md"
37
+ ],
38
+ "scripts": {
39
+ "clean": "rimraf dist && rimraf tsconfig.build.tsbuildinfo",
40
+ "versionUp": "node tools/versionUp.js",
41
+ "build": "tsc -p ./tsconfig.build.json",
42
+ "test": "echo \"Error: run test from the root of the monorepo\" && exit 1"
43
+ },
44
+ "peerDependencies": {
45
+ "@babylonjs/core": "^7.11.2"
46
+ }
47
+ }