@onerjs/smart-filters 8.25.1 → 8.25.3
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.
- package/dist/IDisposable.d.ts +10 -0
- package/dist/IDisposable.d.ts.map +1 -0
- package/dist/IDisposable.js +2 -0
- package/dist/IDisposable.js.map +1 -0
- package/dist/blockFoundation/aggregateBlock.d.ts +56 -0
- package/dist/blockFoundation/aggregateBlock.d.ts.map +1 -0
- package/dist/blockFoundation/aggregateBlock.js +130 -0
- package/dist/blockFoundation/aggregateBlock.js.map +1 -0
- package/dist/blockFoundation/baseBlock.d.ts +176 -0
- package/dist/blockFoundation/baseBlock.d.ts.map +1 -0
- package/dist/blockFoundation/baseBlock.js +276 -0
- package/dist/blockFoundation/baseBlock.js.map +1 -0
- package/dist/blockFoundation/customAggregateBlock.d.ts +38 -0
- package/dist/blockFoundation/customAggregateBlock.d.ts.map +1 -0
- package/dist/blockFoundation/customAggregateBlock.js +63 -0
- package/dist/blockFoundation/customAggregateBlock.js.map +1 -0
- package/dist/blockFoundation/customShaderBlock.d.ts +73 -0
- package/dist/blockFoundation/customShaderBlock.d.ts.map +1 -0
- package/dist/blockFoundation/customShaderBlock.js +232 -0
- package/dist/blockFoundation/customShaderBlock.js.map +1 -0
- package/dist/blockFoundation/disableableShaderBlock.d.ts +56 -0
- package/dist/blockFoundation/disableableShaderBlock.d.ts.map +1 -0
- package/dist/blockFoundation/disableableShaderBlock.js +68 -0
- package/dist/blockFoundation/disableableShaderBlock.js.map +1 -0
- package/dist/blockFoundation/index.d.ts +10 -0
- package/dist/blockFoundation/index.d.ts.map +1 -0
- package/dist/blockFoundation/index.js +8 -0
- package/dist/blockFoundation/index.js.map +1 -0
- package/dist/blockFoundation/inputBlock.d.ts +127 -0
- package/dist/blockFoundation/inputBlock.d.ts.map +1 -0
- package/dist/blockFoundation/inputBlock.deserializer.d.ts +12 -0
- package/dist/blockFoundation/inputBlock.deserializer.d.ts.map +1 -0
- package/dist/blockFoundation/inputBlock.deserializer.js +65 -0
- package/dist/blockFoundation/inputBlock.deserializer.js.map +1 -0
- package/dist/blockFoundation/inputBlock.js +89 -0
- package/dist/blockFoundation/inputBlock.js.map +1 -0
- package/dist/blockFoundation/inputBlock.serialization.types.d.ts +105 -0
- package/dist/blockFoundation/inputBlock.serialization.types.d.ts.map +1 -0
- package/dist/blockFoundation/inputBlock.serialization.types.js +2 -0
- package/dist/blockFoundation/inputBlock.serialization.types.js.map +1 -0
- package/dist/blockFoundation/inputBlock.serializer.d.ts +6 -0
- package/dist/blockFoundation/inputBlock.serializer.d.ts.map +1 -0
- package/dist/blockFoundation/inputBlock.serializer.js +130 -0
- package/dist/blockFoundation/inputBlock.serializer.js.map +1 -0
- package/dist/blockFoundation/outputBlock.d.ts +47 -0
- package/dist/blockFoundation/outputBlock.d.ts.map +1 -0
- package/dist/blockFoundation/outputBlock.js +123 -0
- package/dist/blockFoundation/outputBlock.js.map +1 -0
- package/dist/blockFoundation/shaderBlock.d.ts +64 -0
- package/dist/blockFoundation/shaderBlock.d.ts.map +1 -0
- package/dist/blockFoundation/shaderBlock.js +125 -0
- package/dist/blockFoundation/shaderBlock.js.map +1 -0
- package/dist/blockFoundation/textureOptions.d.ts +47 -0
- package/dist/blockFoundation/textureOptions.d.ts.map +1 -0
- package/dist/blockFoundation/textureOptions.js +37 -0
- package/dist/blockFoundation/textureOptions.js.map +1 -0
- package/dist/command/command.d.ts +48 -0
- package/dist/command/command.d.ts.map +1 -0
- package/dist/command/command.js +15 -0
- package/dist/command/command.js.map +1 -0
- package/dist/command/commandBuffer.d.ts +40 -0
- package/dist/command/commandBuffer.d.ts.map +1 -0
- package/dist/command/commandBuffer.js +58 -0
- package/dist/command/commandBuffer.js.map +1 -0
- package/dist/command/commandBufferDebugger.d.ts +7 -0
- package/dist/command/commandBufferDebugger.d.ts.map +1 -0
- package/dist/command/commandBufferDebugger.js +13 -0
- package/dist/command/commandBufferDebugger.js.map +1 -0
- package/dist/command/index.d.ts +6 -0
- package/dist/command/index.d.ts.map +1 -0
- package/dist/command/index.js +8 -0
- package/dist/command/index.js.map +1 -0
- package/dist/connection/connectionPoint.d.ts +110 -0
- package/dist/connection/connectionPoint.d.ts.map +1 -0
- package/dist/connection/connectionPoint.js +154 -0
- package/dist/connection/connectionPoint.js.map +1 -0
- package/dist/connection/connectionPointCompatibilityState.d.ts +20 -0
- package/dist/connection/connectionPointCompatibilityState.d.ts.map +1 -0
- package/dist/connection/connectionPointCompatibilityState.js +32 -0
- package/dist/connection/connectionPointCompatibilityState.js.map +1 -0
- package/dist/connection/connectionPointDirection.d.ts +10 -0
- package/dist/connection/connectionPointDirection.d.ts.map +1 -0
- package/dist/connection/connectionPointDirection.js +11 -0
- package/dist/connection/connectionPointDirection.js.map +1 -0
- package/dist/connection/connectionPointType.d.ts +29 -0
- package/dist/connection/connectionPointType.d.ts.map +1 -0
- package/dist/connection/connectionPointType.js +19 -0
- package/dist/connection/connectionPointType.js.map +1 -0
- package/dist/connection/connectionPointWithDefault.d.ts +23 -0
- package/dist/connection/connectionPointWithDefault.d.ts.map +1 -0
- package/dist/connection/connectionPointWithDefault.js +19 -0
- package/dist/connection/connectionPointWithDefault.js.map +1 -0
- package/dist/connection/index.d.ts +8 -0
- package/dist/connection/index.d.ts.map +1 -0
- package/dist/connection/index.js +7 -0
- package/dist/connection/index.js.map +1 -0
- package/dist/editorUtils/editableInPropertyPage.d.ts +80 -0
- package/dist/editorUtils/editableInPropertyPage.d.ts.map +1 -0
- package/dist/editorUtils/editableInPropertyPage.js +42 -0
- package/dist/editorUtils/editableInPropertyPage.js.map +1 -0
- package/dist/editorUtils/index.d.ts +3 -0
- package/dist/editorUtils/index.d.ts.map +1 -0
- package/dist/editorUtils/index.js +4 -0
- package/dist/editorUtils/index.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/optimization/dependencyGraph.d.ts +31 -0
- package/dist/optimization/dependencyGraph.d.ts.map +1 -0
- package/dist/optimization/dependencyGraph.js +78 -0
- package/dist/optimization/dependencyGraph.js.map +1 -0
- package/dist/optimization/index.d.ts +2 -0
- package/dist/optimization/index.d.ts.map +1 -0
- package/dist/optimization/index.js +2 -0
- package/dist/optimization/index.js.map +1 -0
- package/dist/optimization/optimizedShaderBlock.d.ts +75 -0
- package/dist/optimization/optimizedShaderBlock.d.ts.map +1 -0
- package/dist/optimization/optimizedShaderBlock.js +105 -0
- package/dist/optimization/optimizedShaderBlock.js.map +1 -0
- package/dist/optimization/smartFilterOptimizer.d.ts +126 -0
- package/dist/optimization/smartFilterOptimizer.d.ts.map +1 -0
- package/dist/optimization/smartFilterOptimizer.js +666 -0
- package/dist/optimization/smartFilterOptimizer.js.map +1 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +7 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/renderTargetGenerator.d.ts +43 -0
- package/dist/runtime/renderTargetGenerator.d.ts.map +1 -0
- package/dist/runtime/renderTargetGenerator.js +169 -0
- package/dist/runtime/renderTargetGenerator.js.map +1 -0
- package/dist/runtime/shaderRuntime.d.ts +103 -0
- package/dist/runtime/shaderRuntime.d.ts.map +1 -0
- package/dist/runtime/shaderRuntime.js +132 -0
- package/dist/runtime/shaderRuntime.js.map +1 -0
- package/dist/runtime/smartFilterRuntime.d.ts +69 -0
- package/dist/runtime/smartFilterRuntime.d.ts.map +1 -0
- package/dist/runtime/smartFilterRuntime.js +63 -0
- package/dist/runtime/smartFilterRuntime.js.map +1 -0
- package/dist/runtime/strongRef.d.ts +16 -0
- package/dist/runtime/strongRef.d.ts.map +1 -0
- package/dist/runtime/strongRef.js +9 -0
- package/dist/runtime/strongRef.js.map +1 -0
- package/dist/serialization/importCustomBlockDefinition.d.ts +15 -0
- package/dist/serialization/importCustomBlockDefinition.d.ts.map +1 -0
- package/dist/serialization/importCustomBlockDefinition.js +76 -0
- package/dist/serialization/importCustomBlockDefinition.js.map +1 -0
- package/dist/serialization/index.d.ts +9 -0
- package/dist/serialization/index.d.ts.map +1 -0
- package/dist/serialization/index.js +11 -0
- package/dist/serialization/index.js.map +1 -0
- package/dist/serialization/serializedBlockDefinition.d.ts +12 -0
- package/dist/serialization/serializedBlockDefinition.d.ts.map +1 -0
- package/dist/serialization/serializedBlockDefinition.js +2 -0
- package/dist/serialization/serializedBlockDefinition.js.map +1 -0
- package/dist/serialization/serializedShaderBlockDefinition.d.ts +7 -0
- package/dist/serialization/serializedShaderBlockDefinition.d.ts.map +1 -0
- package/dist/serialization/serializedShaderBlockDefinition.js +2 -0
- package/dist/serialization/serializedShaderBlockDefinition.js.map +1 -0
- package/dist/serialization/serializedSmartFilter.d.ts +6 -0
- package/dist/serialization/serializedSmartFilter.d.ts.map +1 -0
- package/dist/serialization/serializedSmartFilter.js +2 -0
- package/dist/serialization/serializedSmartFilter.js.map +1 -0
- package/dist/serialization/smartFilterDeserializer.d.ts +34 -0
- package/dist/serialization/smartFilterDeserializer.d.ts.map +1 -0
- package/dist/serialization/smartFilterDeserializer.js +141 -0
- package/dist/serialization/smartFilterDeserializer.js.map +1 -0
- package/dist/serialization/smartFilterSerializer.d.ts +23 -0
- package/dist/serialization/smartFilterSerializer.d.ts.map +1 -0
- package/dist/serialization/smartFilterSerializer.js +95 -0
- package/dist/serialization/smartFilterSerializer.js.map +1 -0
- package/dist/serialization/v1/defaultBlockSerializer.d.ts +9 -0
- package/dist/serialization/v1/defaultBlockSerializer.d.ts.map +1 -0
- package/dist/serialization/v1/defaultBlockSerializer.js +19 -0
- package/dist/serialization/v1/defaultBlockSerializer.js.map +1 -0
- package/dist/serialization/v1/index.d.ts +4 -0
- package/dist/serialization/v1/index.d.ts.map +1 -0
- package/dist/serialization/v1/index.js +5 -0
- package/dist/serialization/v1/index.js.map +1 -0
- package/dist/serialization/v1/shaderBlockSerialization.types.d.ts +73 -0
- package/dist/serialization/v1/shaderBlockSerialization.types.d.ts.map +1 -0
- package/dist/serialization/v1/shaderBlockSerialization.types.js +7 -0
- package/dist/serialization/v1/shaderBlockSerialization.types.js.map +1 -0
- package/dist/serialization/v1/smartFilterSerialization.types.d.ts +98 -0
- package/dist/serialization/v1/smartFilterSerialization.types.d.ts.map +1 -0
- package/dist/serialization/v1/smartFilterSerialization.types.js +2 -0
- package/dist/serialization/v1/smartFilterSerialization.types.js.map +1 -0
- package/dist/smartFilter.d.ts +118 -0
- package/dist/smartFilter.d.ts.map +1 -0
- package/dist/smartFilter.js +169 -0
- package/dist/smartFilter.js.map +1 -0
- package/dist/utils/buildTools/buildShaders.d.ts +9 -0
- package/dist/utils/buildTools/buildShaders.d.ts.map +1 -0
- package/dist/utils/buildTools/buildShaders.js +13 -0
- package/dist/utils/buildTools/buildShaders.js.map +1 -0
- package/dist/utils/buildTools/convertGlslIntoBlock.d.ts +9 -0
- package/dist/utils/buildTools/convertGlslIntoBlock.d.ts.map +1 -0
- package/dist/utils/buildTools/convertGlslIntoBlock.js +346 -0
- package/dist/utils/buildTools/convertGlslIntoBlock.js.map +1 -0
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.d.ts +26 -0
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.d.ts.map +1 -0
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.js +141 -0
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.js.map +1 -0
- package/dist/utils/buildTools/convertShaders.d.ts +16 -0
- package/dist/utils/buildTools/convertShaders.d.ts.map +1 -0
- package/dist/utils/buildTools/convertShaders.js +62 -0
- package/dist/utils/buildTools/convertShaders.js.map +1 -0
- package/dist/utils/buildTools/shaderCode.types.d.ts +51 -0
- package/dist/utils/buildTools/shaderCode.types.d.ts.map +1 -0
- package/dist/utils/buildTools/shaderCode.types.js +2 -0
- package/dist/utils/buildTools/shaderCode.types.js.map +1 -0
- package/dist/utils/buildTools/shaderConverter.d.ts +77 -0
- package/dist/utils/buildTools/shaderConverter.d.ts.map +1 -0
- package/dist/utils/buildTools/shaderConverter.js +297 -0
- package/dist/utils/buildTools/shaderConverter.js.map +1 -0
- package/dist/utils/buildTools/watchShaders.d.ts +9 -0
- package/dist/utils/buildTools/watchShaders.d.ts.map +1 -0
- package/dist/utils/buildTools/watchShaders.js +39 -0
- package/dist/utils/buildTools/watchShaders.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/renderTargetUtils.d.ts +14 -0
- package/dist/utils/renderTargetUtils.d.ts.map +1 -0
- package/dist/utils/renderTargetUtils.js +23 -0
- package/dist/utils/renderTargetUtils.js.map +1 -0
- package/dist/utils/shaderCodeUtils.d.ts +91 -0
- package/dist/utils/shaderCodeUtils.d.ts.map +1 -0
- package/dist/utils/shaderCodeUtils.js +111 -0
- package/dist/utils/shaderCodeUtils.js.map +1 -0
- package/dist/utils/textureLoaders.d.ts +16 -0
- package/dist/utils/textureLoaders.d.ts.map +1 -0
- package/dist/utils/textureLoaders.js +22 -0
- package/dist/utils/textureLoaders.js.map +1 -0
- package/dist/utils/textureUtils.d.ts +13 -0
- package/dist/utils/textureUtils.d.ts.map +1 -0
- package/dist/utils/textureUtils.js +25 -0
- package/dist/utils/textureUtils.js.map +1 -0
- package/dist/utils/uniqueIdGenerator.d.ts +19 -0
- package/dist/utils/uniqueIdGenerator.d.ts.map +1 -0
- package/dist/utils/uniqueIdGenerator.js +27 -0
- package/dist/utils/uniqueIdGenerator.js.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +1 -1
- package/src/optimization/smartFilterOptimizer.ts +305 -158
- package/src/version.ts +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes a shader function.
|
|
3
|
+
*/
|
|
4
|
+
export type ShaderFunction = {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the function.
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* The code of the function.
|
|
11
|
+
*/
|
|
12
|
+
code: string;
|
|
13
|
+
/**
|
|
14
|
+
* The parameters of the function.
|
|
15
|
+
*/
|
|
16
|
+
params?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Describes a shader code.
|
|
20
|
+
*/
|
|
21
|
+
export type ShaderCode = {
|
|
22
|
+
/**
|
|
23
|
+
* The declaration of the const variables.
|
|
24
|
+
*/
|
|
25
|
+
const?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The declaration of the uniform variables.
|
|
28
|
+
*/
|
|
29
|
+
uniform?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The declaration of the uniform variables that should be common for all ShaderBlock instances using this shader code.
|
|
32
|
+
*/
|
|
33
|
+
uniformSingle?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The name of the main function.
|
|
36
|
+
*/
|
|
37
|
+
mainFunctionName: string;
|
|
38
|
+
/**
|
|
39
|
+
* The name of the input texture which is passed through if the block is disabled.
|
|
40
|
+
*/
|
|
41
|
+
mainInputTexture?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The list of functions used in the shader.
|
|
44
|
+
*/
|
|
45
|
+
functions: ShaderFunction[];
|
|
46
|
+
/**
|
|
47
|
+
* The declaration of define statements.
|
|
48
|
+
*/
|
|
49
|
+
defines?: string[];
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=shaderCode.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shaderCode.types.d.ts","sourceRoot":"","sources":["../../../src/utils/buildTools/shaderCode.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,SAAS,EAAE,cAAc,EAAE,CAAC;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shaderCode.types.js","sourceRoot":"","sources":["../../../src/utils/buildTools/shaderCode.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Nullable } from "@onerjs/core/types.js";
|
|
2
|
+
import type { ShaderCode } from "./shaderCode.types.js";
|
|
3
|
+
import { ConnectionPointType } from "../../connection/connectionPointType.js";
|
|
4
|
+
import { BlockDisableStrategy } from "../../blockFoundation/disableableShaderBlock.js";
|
|
5
|
+
/**
|
|
6
|
+
* Describes the supported metadata properties for a uniform
|
|
7
|
+
*/
|
|
8
|
+
export type UniformMetadataProperties = {
|
|
9
|
+
/**
|
|
10
|
+
* If supplied, the default value to use for the corresponding input connection point
|
|
11
|
+
*/
|
|
12
|
+
default?: any;
|
|
13
|
+
/**
|
|
14
|
+
* If supplied, the input will be automatically bound to this value, instead of creating an input connection point
|
|
15
|
+
* @see InputAutoBindV1 for possible values.
|
|
16
|
+
*/
|
|
17
|
+
autoBind?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Describes a uniform in a shader
|
|
21
|
+
*/
|
|
22
|
+
export type UniformMetadata = {
|
|
23
|
+
/**
|
|
24
|
+
* The original name of the uniform (not renamed)
|
|
25
|
+
*/
|
|
26
|
+
name: string;
|
|
27
|
+
/**
|
|
28
|
+
* The type string of the uniform
|
|
29
|
+
*/
|
|
30
|
+
type: ConnectionPointType;
|
|
31
|
+
/**
|
|
32
|
+
* Optional properties of the uniform
|
|
33
|
+
*/
|
|
34
|
+
properties?: UniformMetadataProperties;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Information about a fragment shader
|
|
38
|
+
*/
|
|
39
|
+
export type FragmentShaderInfo = {
|
|
40
|
+
/**
|
|
41
|
+
* If supplied, the blockType to use for the block
|
|
42
|
+
*/
|
|
43
|
+
blockType?: string;
|
|
44
|
+
/**
|
|
45
|
+
* If supplied, the namespace of the block
|
|
46
|
+
*/
|
|
47
|
+
namespace: Nullable<string>;
|
|
48
|
+
/**
|
|
49
|
+
* If true, optimization should be disabled for this shader
|
|
50
|
+
*/
|
|
51
|
+
disableOptimization?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* If supplied, the strategy to use for making this block disableable
|
|
54
|
+
*/
|
|
55
|
+
blockDisableStrategy?: BlockDisableStrategy;
|
|
56
|
+
/**
|
|
57
|
+
* The shader code
|
|
58
|
+
*/
|
|
59
|
+
shaderCode: ShaderCode;
|
|
60
|
+
/**
|
|
61
|
+
* The set of uniforms
|
|
62
|
+
*/
|
|
63
|
+
uniforms: UniformMetadata[];
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Parses a fragment shader
|
|
67
|
+
* @param fragmentShader - The fragment shader to process
|
|
68
|
+
* @returns The processed fragment shader
|
|
69
|
+
*/
|
|
70
|
+
export declare function ParseFragmentShader(fragmentShader: string): FragmentShaderInfo;
|
|
71
|
+
/**
|
|
72
|
+
* Determines if a fragment shader has the GLSL header required for parsing
|
|
73
|
+
* @param fragmentShader - The fragment shader to check
|
|
74
|
+
* @returns True if the fragment shader has the GLSL header
|
|
75
|
+
*/
|
|
76
|
+
export declare function HasGlslHeader(fragmentShader: string): boolean;
|
|
77
|
+
//# sourceMappingURL=shaderConverter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shaderConverter.d.ts","sourceRoot":"","sources":["../../../src/utils/buildTools/shaderConverter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,8BAAsB;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AAiBvF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC;IAEd;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,mBAAmB,CAAC;IAE1B;;OAEG;IACH,UAAU,CAAC,EAAE,yBAAyB,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE5B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAE5C;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IAEvB;;OAEG;IACH,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC/B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,kBAAkB,CAwI9E;AAiOD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAE7D"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { Logger } from "@onerjs/core/Misc/logger.js";
|
|
2
|
+
import { ConnectionPointType } from "../../connection/connectionPointType.js";
|
|
3
|
+
import { BlockDisableStrategy } from "../../blockFoundation/disableableShaderBlock.js";
|
|
4
|
+
// Note: creating a global RegExp object is risky, because it holds state (e.g. lastIndex) that has to be
|
|
5
|
+
// cleared at the right time to ensure correctness, which is easy to forget to do.
|
|
6
|
+
// Instead, for regular expressions used in multiple places, we define the string and options once, and create
|
|
7
|
+
// a new RegExp object from them when needed, to ensure state isn't accidentally reused.
|
|
8
|
+
// Matches a function's name and its parameters
|
|
9
|
+
const GetFunctionHeaderRegExString = `\\S*\\w+\\s+(\\w+)\\s*\\((.*?)\\)\\s*\\{`;
|
|
10
|
+
const GetFunctionHeaderRegExOptions = "g";
|
|
11
|
+
// Matches a #define statement line, capturing its name
|
|
12
|
+
const GetDefineRegExString = `^\\S*#define\\s+(\\w+).*$`;
|
|
13
|
+
const GetDefineRegExOptions = "gm";
|
|
14
|
+
const ReservedSymbols = ["main"];
|
|
15
|
+
/**
|
|
16
|
+
* Parses a fragment shader
|
|
17
|
+
* @param fragmentShader - The fragment shader to process
|
|
18
|
+
* @returns The processed fragment shader
|
|
19
|
+
*/
|
|
20
|
+
export function ParseFragmentShader(fragmentShader) {
|
|
21
|
+
const { header, fragmentShaderWithoutHeader } = ReadHeader(fragmentShader);
|
|
22
|
+
fragmentShader = fragmentShaderWithoutHeader;
|
|
23
|
+
const blockType = header?.[SmartFilterBlockTypeKey] || undefined;
|
|
24
|
+
const namespace = header?.namespace || null;
|
|
25
|
+
// Read the uniforms
|
|
26
|
+
const uniforms = [];
|
|
27
|
+
const uniformRegExp = new RegExp(/(\/\/\s*\{.*\}\s*(?:\r\n|\r|\n)+)?(uniform .*)/gm);
|
|
28
|
+
const uniformGroups = fragmentShader.matchAll(uniformRegExp);
|
|
29
|
+
for (const matches of uniformGroups) {
|
|
30
|
+
const annotationJSON = matches[1];
|
|
31
|
+
const uniformLine = matches[2];
|
|
32
|
+
if (!uniformLine) {
|
|
33
|
+
throw new Error("Uniform line not found");
|
|
34
|
+
}
|
|
35
|
+
const uniformLineMatches = new RegExp(/^uniform\s+(\w+)\s+(\w+)\s*;?/gm).exec(uniformLine);
|
|
36
|
+
if (!uniformLineMatches || uniformLineMatches.length < 3) {
|
|
37
|
+
throw new Error(`Uniforms must have a type and a name: '${uniformLine}'`);
|
|
38
|
+
}
|
|
39
|
+
const uniformTypeString = uniformLineMatches[1];
|
|
40
|
+
const uniformName = uniformLineMatches[2];
|
|
41
|
+
if (!uniformTypeString) {
|
|
42
|
+
throw new Error(`Uniforms must have a type: '${uniformLine}'`);
|
|
43
|
+
}
|
|
44
|
+
if (!uniformName) {
|
|
45
|
+
throw new Error(`Uniforms must have a name: '${uniformLine}'`);
|
|
46
|
+
}
|
|
47
|
+
// Convert to ConnectionPointType
|
|
48
|
+
let type;
|
|
49
|
+
switch (uniformTypeString) {
|
|
50
|
+
case "float":
|
|
51
|
+
type = ConnectionPointType.Float;
|
|
52
|
+
break;
|
|
53
|
+
case "sampler2D":
|
|
54
|
+
type = ConnectionPointType.Texture;
|
|
55
|
+
break;
|
|
56
|
+
case "vec3":
|
|
57
|
+
type = ConnectionPointType.Color3;
|
|
58
|
+
break;
|
|
59
|
+
case "vec4":
|
|
60
|
+
type = ConnectionPointType.Color4;
|
|
61
|
+
break;
|
|
62
|
+
case "bool":
|
|
63
|
+
type = ConnectionPointType.Boolean;
|
|
64
|
+
break;
|
|
65
|
+
case "vec2":
|
|
66
|
+
type = ConnectionPointType.Vector2;
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
throw new Error(`Unsupported uniform type: '${uniformTypeString}'`);
|
|
70
|
+
}
|
|
71
|
+
uniforms.push({
|
|
72
|
+
name: uniformName,
|
|
73
|
+
type,
|
|
74
|
+
properties: annotationJSON ? JSON.parse(annotationJSON.replace("//", "").trim()) : undefined,
|
|
75
|
+
});
|
|
76
|
+
if (annotationJSON) {
|
|
77
|
+
// Strip out any annotation so it isn't mistaken for function bodies
|
|
78
|
+
fragmentShader = fragmentShader.replace(annotationJSON, "");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const fragmentShaderWithNoFunctionBodies = RemoveFunctionBodies(fragmentShader);
|
|
82
|
+
// Collect uniform, const, and function names which need to be decorated
|
|
83
|
+
// eslint-disable-next-line prettier/prettier
|
|
84
|
+
const uniformNames = uniforms.map((uniform) => uniform.name);
|
|
85
|
+
Logger.Log(`Uniforms found: ${JSON.stringify(uniforms)}`);
|
|
86
|
+
const consts = [...fragmentShader.matchAll(/\S*const\s+\w*\s+(\w*)\s*=.*;/g)].map((match) => match[1]);
|
|
87
|
+
Logger.Log(`Consts found: ${JSON.stringify(consts)}`);
|
|
88
|
+
const defineNames = [...fragmentShader.matchAll(new RegExp(GetDefineRegExString, GetDefineRegExOptions))].map((match) => match[1]);
|
|
89
|
+
Logger.Log(`Defines found: ${JSON.stringify(defineNames)}`);
|
|
90
|
+
const functionNames = [...fragmentShaderWithNoFunctionBodies.matchAll(new RegExp(GetFunctionHeaderRegExString, GetFunctionHeaderRegExOptions))].map((match) => match[1]);
|
|
91
|
+
Logger.Log(`Functions found: ${JSON.stringify(functionNames)}`);
|
|
92
|
+
// Decorate the uniforms, consts, defines, and functions
|
|
93
|
+
const symbolsToDecorate = [...uniformNames, ...consts, ...defineNames, ...functionNames];
|
|
94
|
+
let fragmentShaderWithRenamedSymbols = fragmentShader;
|
|
95
|
+
for (const symbol of symbolsToDecorate) {
|
|
96
|
+
if (!symbol) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (ReservedSymbols.indexOf(symbol) !== -1) {
|
|
100
|
+
throw new Error(`Symbol "${symbol}" is reserved and cannot be used`);
|
|
101
|
+
}
|
|
102
|
+
const regex = new RegExp(`(?<=\\W+)${symbol}(?=\\W+)`, "gs");
|
|
103
|
+
fragmentShaderWithRenamedSymbols = fragmentShaderWithRenamedSymbols.replace(regex, `_${symbol}_`);
|
|
104
|
+
}
|
|
105
|
+
Logger.Log(`${symbolsToDecorate.length} symbol(s) renamed`);
|
|
106
|
+
// Extract all the uniforms
|
|
107
|
+
const finalUniforms = [...fragmentShaderWithRenamedSymbols.matchAll(/^\s*(uniform\s.*)/gm)].map((match) => match[1]);
|
|
108
|
+
// Extract all the consts
|
|
109
|
+
const finalConsts = [...fragmentShaderWithRenamedSymbols.matchAll(/^\s*(const\s.*)/gm)].map((match) => match[1]);
|
|
110
|
+
// Extract all the defines
|
|
111
|
+
const finalDefines = [...fragmentShaderWithRenamedSymbols.matchAll(new RegExp(GetDefineRegExString, GetDefineRegExOptions))].map((match) => match[0]);
|
|
112
|
+
// Find the main input
|
|
113
|
+
const mainInputs = [...fragmentShaderWithRenamedSymbols.matchAll(/\S*uniform.*\s(\w*);\s*\/\/\s*main/gm)].map((match) => match[1]);
|
|
114
|
+
if (mainInputs.length > 1) {
|
|
115
|
+
throw new Error("Shaders may have no more than 1 main input");
|
|
116
|
+
}
|
|
117
|
+
const mainInputTexture = mainInputs[0];
|
|
118
|
+
// Extract all the functions
|
|
119
|
+
const { extractedFunctions, mainFunctionName } = ExtractFunctions(fragmentShaderWithRenamedSymbols);
|
|
120
|
+
const shaderCode = {
|
|
121
|
+
uniform: finalUniforms.join("\n"),
|
|
122
|
+
mainFunctionName,
|
|
123
|
+
mainInputTexture,
|
|
124
|
+
functions: extractedFunctions,
|
|
125
|
+
defines: finalDefines,
|
|
126
|
+
};
|
|
127
|
+
if (finalConsts.length > 0) {
|
|
128
|
+
shaderCode.const = finalConsts.join("\n");
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
blockType,
|
|
132
|
+
namespace,
|
|
133
|
+
shaderCode,
|
|
134
|
+
uniforms,
|
|
135
|
+
disableOptimization: !!header?.disableOptimization,
|
|
136
|
+
blockDisableStrategy: header?.blockDisableStrategy,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Extracts all functions from the shader
|
|
141
|
+
* @param fragment - The shader code to process
|
|
142
|
+
* @returns A list of functions
|
|
143
|
+
*/
|
|
144
|
+
function ExtractFunctions(fragment) {
|
|
145
|
+
const extractedFunctions = [];
|
|
146
|
+
let mainFunctionName;
|
|
147
|
+
let pos = 0;
|
|
148
|
+
const getFunctionHeaderRegEx = new RegExp(GetFunctionHeaderRegExString, GetFunctionHeaderRegExOptions);
|
|
149
|
+
while (pos < fragment.length) {
|
|
150
|
+
// Match the next available function header in the fragment code
|
|
151
|
+
getFunctionHeaderRegEx.lastIndex = pos;
|
|
152
|
+
const match = getFunctionHeaderRegEx.exec(fragment);
|
|
153
|
+
if (!match) {
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
const functionName = match[1];
|
|
157
|
+
if (!functionName) {
|
|
158
|
+
throw new Error("No function name found in shader code");
|
|
159
|
+
}
|
|
160
|
+
const functionParams = match[2] || "";
|
|
161
|
+
// Store start index of the function definition
|
|
162
|
+
const startIndex = match.index;
|
|
163
|
+
// Balance braces to find end of function, starting just after the opening `{`
|
|
164
|
+
let endIndex = match.index + match[0].length;
|
|
165
|
+
let depth = 1;
|
|
166
|
+
while (depth > 0 && endIndex < fragment.length) {
|
|
167
|
+
if (fragment[endIndex] === "{") {
|
|
168
|
+
depth++;
|
|
169
|
+
}
|
|
170
|
+
else if (fragment[endIndex] === "}") {
|
|
171
|
+
depth--;
|
|
172
|
+
}
|
|
173
|
+
endIndex++;
|
|
174
|
+
}
|
|
175
|
+
if (depth !== 0) {
|
|
176
|
+
throw new Error(`Mismatched curly braces found near: ${functionName}`);
|
|
177
|
+
}
|
|
178
|
+
// Finally, process the function code
|
|
179
|
+
let functionCode = fragment.substring(startIndex, endIndex).trim();
|
|
180
|
+
// Check if this function is the main function
|
|
181
|
+
if (functionCode.includes("// main")) {
|
|
182
|
+
if (mainFunctionName) {
|
|
183
|
+
throw new Error("Multiple main functions found in shader code");
|
|
184
|
+
}
|
|
185
|
+
mainFunctionName = functionName;
|
|
186
|
+
functionCode = functionCode.replace("// main", "");
|
|
187
|
+
}
|
|
188
|
+
extractedFunctions.push({
|
|
189
|
+
name: functionName,
|
|
190
|
+
code: functionCode,
|
|
191
|
+
params: functionParams.trim(),
|
|
192
|
+
});
|
|
193
|
+
pos = endIndex;
|
|
194
|
+
}
|
|
195
|
+
if (!mainFunctionName) {
|
|
196
|
+
throw new Error("No main function found in shader code");
|
|
197
|
+
}
|
|
198
|
+
return { extractedFunctions, mainFunctionName };
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Removes all function bodies from the shader code, leaving just curly braces behind at the top level
|
|
202
|
+
* @param input - The shader code to process
|
|
203
|
+
* @returns The shader code with all function bodies removed
|
|
204
|
+
*/
|
|
205
|
+
function RemoveFunctionBodies(input) {
|
|
206
|
+
let output = "";
|
|
207
|
+
let depth = 0;
|
|
208
|
+
for (let pos = 0; pos < input.length; pos++) {
|
|
209
|
+
if (input[pos] === "{") {
|
|
210
|
+
depth++;
|
|
211
|
+
// Special case - if we just hit the first { then include it
|
|
212
|
+
if (depth === 1) {
|
|
213
|
+
output += "{";
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else if (input[pos] === "}") {
|
|
217
|
+
depth--;
|
|
218
|
+
// Special case - if we just hit the last } then include it
|
|
219
|
+
if (depth === 0) {
|
|
220
|
+
output += "}";
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else if (depth === 0) {
|
|
224
|
+
output += input[pos];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (depth !== 0) {
|
|
228
|
+
Logger.Error("Unbalanced curly braces in shader code");
|
|
229
|
+
}
|
|
230
|
+
return output;
|
|
231
|
+
}
|
|
232
|
+
const SmartFilterBlockTypeKey = "smartFilterBlockType";
|
|
233
|
+
/**
|
|
234
|
+
* Reads the GlslHeader from the shader code
|
|
235
|
+
* @param fragmentShader - The shader code to read
|
|
236
|
+
* @returns - The GlslHeader if found, otherwise null
|
|
237
|
+
*/
|
|
238
|
+
function ReadHeader(fragmentShader) {
|
|
239
|
+
const singleLineHeaderMatch = new RegExp(/^\n*\s*\/\/\s*(\{.*\})/g).exec(fragmentShader);
|
|
240
|
+
if (singleLineHeaderMatch && singleLineHeaderMatch[1]) {
|
|
241
|
+
return {
|
|
242
|
+
header: ParseHeader(singleLineHeaderMatch[1].trim()),
|
|
243
|
+
fragmentShaderWithoutHeader: fragmentShader.replace(singleLineHeaderMatch[0], ""),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const multiLineHeaderMatch = new RegExp(/^\n*\s*\/\*\s*(\{.*\})\s*\*\//gs).exec(fragmentShader);
|
|
247
|
+
if (multiLineHeaderMatch && multiLineHeaderMatch[1]) {
|
|
248
|
+
return {
|
|
249
|
+
header: ParseHeader(multiLineHeaderMatch[1].trim()),
|
|
250
|
+
fragmentShaderWithoutHeader: fragmentShader.replace(multiLineHeaderMatch[0], ""),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
header: null,
|
|
255
|
+
fragmentShaderWithoutHeader: fragmentShader,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Parses the header from a string into a GlslHeader object
|
|
260
|
+
* @param header - The header string to parse
|
|
261
|
+
* @returns - The GlslHeader if the header is valid, otherwise null
|
|
262
|
+
*/
|
|
263
|
+
function ParseHeader(header) {
|
|
264
|
+
const parsedObject = JSON.parse(header);
|
|
265
|
+
if (!parsedObject || typeof parsedObject !== "object") {
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
// Check for required properties
|
|
269
|
+
if (!parsedObject[SmartFilterBlockTypeKey]) {
|
|
270
|
+
throw new Error("Missing required property: " + SmartFilterBlockTypeKey);
|
|
271
|
+
}
|
|
272
|
+
const glslHeader = parsedObject;
|
|
273
|
+
// Fix up the disableStrategy to be a BlockDisableStrategy
|
|
274
|
+
if (glslHeader.blockDisableStrategy) {
|
|
275
|
+
const rawStrategyValue = glslHeader.blockDisableStrategy;
|
|
276
|
+
switch (rawStrategyValue) {
|
|
277
|
+
case "Manual":
|
|
278
|
+
glslHeader.blockDisableStrategy = BlockDisableStrategy.Manual;
|
|
279
|
+
break;
|
|
280
|
+
case "AutoSample":
|
|
281
|
+
glslHeader.blockDisableStrategy = BlockDisableStrategy.AutoSample;
|
|
282
|
+
break;
|
|
283
|
+
default:
|
|
284
|
+
throw new Error(`Invalid disableStrategy: ${rawStrategyValue}`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return glslHeader;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Determines if a fragment shader has the GLSL header required for parsing
|
|
291
|
+
* @param fragmentShader - The fragment shader to check
|
|
292
|
+
* @returns True if the fragment shader has the GLSL header
|
|
293
|
+
*/
|
|
294
|
+
export function HasGlslHeader(fragmentShader) {
|
|
295
|
+
return fragmentShader.indexOf(SmartFilterBlockTypeKey) !== -1;
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=shaderConverter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shaderConverter.js","sourceRoot":"","sources":["../../../src/utils/buildTools/shaderConverter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,oCAA4B;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AAEvF,yGAAyG;AACzG,kFAAkF;AAClF,8GAA8G;AAC9G,wFAAwF;AAExF,+CAA+C;AAC/C,MAAM,4BAA4B,GAAG,0CAA0C,CAAC;AAChF,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAE1C,uDAAuD;AACvD,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AACzD,MAAM,qBAAqB,GAAG,IAAI,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CAAC,uBAAuB,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,uBAAuB,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,UAAU,GAAG,YAA0B,CAAC;IAE9C,0DAA0D;IAC1D,IAAI,UAAU,CAAC,oBAAoB,EAAE,CAAC;QAClC,MAAM,gBAAgB,GAAG,UAAU,CAAC,oBAAoB,CAAC;QACzD,QAAQ,gBAAqC,EAAE,CAAC;YAC5C,KAAK,QAAQ;gBACT,UAAU,CAAC,oBAAoB,GAAG,oBAAoB,CAAC,MAAM,CAAC;gBAC9D,MAAM;YACV,KAAK,YAAY;gBACb,UAAU,CAAC,oBAAoB,GAAG,oBAAoB,CAAC,UAAU,CAAC;gBAClE,MAAM;YACV;gBACI,MAAM,IAAI,KAAK,CAAC,4BAA4B,gBAAgB,EAAE,CAAC,CAAC;QACxE,CAAC;IACL,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,cAAsB;IAChD,OAAO,cAAc,CAAC,OAAO,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Watches all .glsl files under <shaderPath> and rebuilds them when changed.
|
|
3
|
+
* @param shaderPath - The path to the shaders to watch
|
|
4
|
+
* @param smartFiltersCorePath - The path to import the Smart Filters core from
|
|
5
|
+
* @param babylonCorePath - The path to import the Babylon core from (optional)
|
|
6
|
+
* @example node watchShaders.js <shaderPath> @babylonjs/smart-filters
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=watchShaders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchShaders.d.ts","sourceRoot":"","sources":["../../../src/utils/buildTools/watchShaders.ts"],"names":[],"mappings":"AACA;;;;;;GAMG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
/**
|
|
3
|
+
* Watches all .glsl files under <shaderPath> and rebuilds them when changed.
|
|
4
|
+
* @param shaderPath - The path to the shaders to watch
|
|
5
|
+
* @param smartFiltersCorePath - The path to import the Smart Filters core from
|
|
6
|
+
* @param babylonCorePath - The path to import the Babylon core from (optional)
|
|
7
|
+
* @example node watchShaders.js <shaderPath> @babylonjs/smart-filters
|
|
8
|
+
*/
|
|
9
|
+
import { watch } from "chokidar";
|
|
10
|
+
import { extname } from "path";
|
|
11
|
+
import { ConvertShader } from "./convertShaders.js";
|
|
12
|
+
const ExternalArguments = process.argv.slice(2);
|
|
13
|
+
if (ExternalArguments.length >= 2 && ExternalArguments[0] && ExternalArguments[1]) {
|
|
14
|
+
const shaderPath = ExternalArguments[0];
|
|
15
|
+
const smartFiltersCorePath = ExternalArguments[1];
|
|
16
|
+
const babylonCorePath = ExternalArguments[2];
|
|
17
|
+
watch(shaderPath).on("all", (event, file) => {
|
|
18
|
+
// Only process file changes and added files
|
|
19
|
+
if (event !== "change" && event !== "add") {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Only process .glsl files
|
|
23
|
+
if (extname(file) !== ".glsl") {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
console.log(`Change detected. Starting conversion...`);
|
|
27
|
+
// Wrap in try-catch to prevent the watcher from crashing
|
|
28
|
+
// if the new shader changes are invalid
|
|
29
|
+
try {
|
|
30
|
+
ConvertShader(file, smartFiltersCorePath, babylonCorePath);
|
|
31
|
+
console.log(`Successfully updated shader ${file}`);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error(`Failed to convert shader ${file}: ${error}`);
|
|
35
|
+
}
|
|
36
|
+
console.log(`Watching for changes in ${shaderPath}...`);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=watchShaders.js.map
|
|
@@ -0,0 +1 @@
|
|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AK,CAAC,4BAA4B,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,2BAA2B,UAAU,KAAK,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EAAE,kBAAkB,IAAI,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,0CAA0C;AAC1C,OAAO,EAAE,kBAAkB,IAAI,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BaseBlock } from "../blockFoundation/baseBlock.js";
|
|
2
|
+
import type { ShaderRuntime } from "../runtime/shaderRuntime.js";
|
|
3
|
+
import type { InternalSmartFilterRuntime } from "../runtime/smartFilterRuntime.js";
|
|
4
|
+
import type { OutputBlock } from "../blockFoundation/outputBlock.js";
|
|
5
|
+
/**
|
|
6
|
+
* Registers the final command of the command queue - the one that draws to either the canvas or
|
|
7
|
+
* renderTargetTexture.
|
|
8
|
+
* @param outputBlock - The output block.
|
|
9
|
+
* @param runtime - The smart filter runtime to use.
|
|
10
|
+
* @param commandOwner - The owner of the command.
|
|
11
|
+
* @param shaderBlockRuntime - The shader block runtime to use.
|
|
12
|
+
*/
|
|
13
|
+
export declare function RegisterFinalRenderCommand(outputBlock: OutputBlock, runtime: InternalSmartFilterRuntime, commandOwner: BaseBlock, shaderBlockRuntime: ShaderRuntime): void;
|
|
14
|
+
//# sourceMappingURL=renderTargetUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderTargetUtils.d.ts","sourceRoot":"","sources":["../../src/utils/renderTargetUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAErE;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,0BAA0B,EAAE,YAAY,EAAE,SAAS,EAAE,kBAAkB,EAAE,aAAa,GAAG,IAAI,CAe1K"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CreateCommand } from "../command/command.js";
|
|
2
|
+
/**
|
|
3
|
+
* Registers the final command of the command queue - the one that draws to either the canvas or
|
|
4
|
+
* renderTargetTexture.
|
|
5
|
+
* @param outputBlock - The output block.
|
|
6
|
+
* @param runtime - The smart filter runtime to use.
|
|
7
|
+
* @param commandOwner - The owner of the command.
|
|
8
|
+
* @param shaderBlockRuntime - The shader block runtime to use.
|
|
9
|
+
*/
|
|
10
|
+
export function RegisterFinalRenderCommand(outputBlock, runtime, commandOwner, shaderBlockRuntime) {
|
|
11
|
+
const commandOwnerBlockType = commandOwner.blockType;
|
|
12
|
+
if (outputBlock.renderTargetWrapper) {
|
|
13
|
+
runtime.registerCommand(CreateCommand(`${commandOwnerBlockType}.renderToFinalTexture`, commandOwner, () => {
|
|
14
|
+
shaderBlockRuntime.renderToTargetWrapper(outputBlock);
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
runtime.registerCommand(CreateCommand(`${commandOwnerBlockType}.renderToCanvas`, commandOwner, () => {
|
|
19
|
+
shaderBlockRuntime.renderToCanvas();
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=renderTargetUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderTargetUtils.js","sourceRoot":"","sources":["../../src/utils/renderTargetUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAMtD;;;;;;;GAOG;AACH,MAAM,UAAU,0BAA0B,CAAC,WAAwB,EAAE,OAAmC,EAAE,YAAuB,EAAE,kBAAiC;IAChK,MAAM,qBAAqB,GAAG,YAAY,CAAC,SAAS,CAAC;IACrD,IAAI,WAAW,CAAC,mBAAmB,EAAE,CAAC;QAClC,OAAO,CAAC,eAAe,CACnB,aAAa,CAAC,GAAG,qBAAqB,uBAAuB,EAAE,YAAY,EAAE,GAAG,EAAE;YAC9E,kBAAkB,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;QAC1D,CAAC,CAAC,CACL,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,eAAe,CACnB,aAAa,CAAC,GAAG,qBAAqB,iBAAiB,EAAE,YAAY,EAAE,GAAG,EAAE;YACxE,kBAAkB,CAAC,cAAc,EAAE,CAAC;QACxC,CAAC,CAAC,CACL,CAAC;IACN,CAAC;AACL,CAAC"}
|