@babylonjs/smart-filters 1.0.13 → 8.18.0
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/blockFoundation/aggregateBlock.d.ts +3 -3
- package/dist/blockFoundation/aggregateBlock.d.ts.map +1 -1
- package/dist/blockFoundation/aggregateBlock.js +1 -2
- package/dist/blockFoundation/aggregateBlock.js.map +1 -1
- package/dist/blockFoundation/baseBlock.d.ts +2 -2
- package/dist/blockFoundation/baseBlock.d.ts.map +1 -1
- package/dist/blockFoundation/baseBlock.js +5 -6
- package/dist/blockFoundation/baseBlock.js.map +1 -1
- package/dist/blockFoundation/customAggregateBlock.d.ts.map +1 -1
- package/dist/blockFoundation/customAggregateBlock.js +2 -2
- package/dist/blockFoundation/customAggregateBlock.js.map +1 -1
- package/dist/blockFoundation/customShaderBlock.d.ts.map +1 -1
- package/dist/blockFoundation/customShaderBlock.js +4 -6
- package/dist/blockFoundation/customShaderBlock.js.map +1 -1
- package/dist/blockFoundation/disableableShaderBlock.d.ts.map +1 -1
- package/dist/blockFoundation/disableableShaderBlock.js +4 -4
- package/dist/blockFoundation/disableableShaderBlock.js.map +1 -1
- package/dist/blockFoundation/index.js +0 -2
- package/dist/blockFoundation/index.js.map +1 -1
- package/dist/blockFoundation/inputBlock.d.ts +8 -8
- package/dist/blockFoundation/inputBlock.d.ts.map +1 -1
- package/dist/blockFoundation/inputBlock.deserializer.d.ts +1 -1
- package/dist/blockFoundation/inputBlock.deserializer.d.ts.map +1 -1
- package/dist/blockFoundation/inputBlock.deserializer.js +1 -1
- package/dist/blockFoundation/inputBlock.deserializer.js.map +1 -1
- package/dist/blockFoundation/inputBlock.js +7 -7
- package/dist/blockFoundation/inputBlock.js.map +1 -1
- package/dist/blockFoundation/inputBlock.serialization.types.d.ts.map +1 -1
- package/dist/blockFoundation/inputBlock.serializer.d.ts +1 -1
- package/dist/blockFoundation/inputBlock.serializer.js +26 -28
- package/dist/blockFoundation/inputBlock.serializer.js.map +1 -1
- package/dist/blockFoundation/outputBlock.d.ts +4 -9
- package/dist/blockFoundation/outputBlock.d.ts.map +1 -1
- package/dist/blockFoundation/outputBlock.js +13 -14
- package/dist/blockFoundation/outputBlock.js.map +1 -1
- package/dist/blockFoundation/shaderBlock.d.ts +4 -4
- package/dist/blockFoundation/shaderBlock.d.ts.map +1 -1
- package/dist/blockFoundation/shaderBlock.js +13 -19
- package/dist/blockFoundation/shaderBlock.js.map +1 -1
- package/dist/blockFoundation/textureOptions.d.ts +1 -1
- package/dist/blockFoundation/textureOptions.js +1 -1
- package/dist/command/command.d.ts +1 -1
- package/dist/command/command.js +1 -1
- package/dist/command/commandBuffer.d.ts +1 -1
- package/dist/command/commandBuffer.d.ts.map +1 -1
- package/dist/command/commandBuffer.js +2 -2
- package/dist/command/commandBufferDebugger.d.ts +2 -2
- package/dist/command/commandBufferDebugger.d.ts.map +1 -1
- package/dist/command/commandBufferDebugger.js +1 -1
- package/dist/command/commandBufferDebugger.js.map +1 -1
- package/dist/command/index.d.ts +3 -1
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +5 -1
- package/dist/command/index.js.map +1 -1
- package/dist/connection/connectionPoint.d.ts +3 -3
- package/dist/connection/connectionPoint.d.ts.map +1 -1
- package/dist/connection/connectionPoint.js +2 -2
- package/dist/connection/connectionPoint.js.map +1 -1
- package/dist/connection/connectionPointCompatibilityState.d.ts +1 -1
- package/dist/connection/connectionPointCompatibilityState.js +1 -1
- package/dist/connection/connectionPointType.d.ts +3 -3
- package/dist/connection/connectionPointType.d.ts.map +1 -1
- package/dist/connection/connectionPointWithDefault.d.ts +3 -3
- package/dist/connection/connectionPointWithDefault.d.ts.map +1 -1
- package/dist/connection/connectionPointWithDefault.js.map +1 -1
- package/dist/connection/index.d.ts +2 -1
- package/dist/connection/index.d.ts.map +1 -1
- package/dist/connection/index.js +3 -3
- package/dist/connection/index.js.map +1 -1
- package/dist/editorUtils/editableInPropertyPage.d.ts +2 -2
- package/dist/editorUtils/editableInPropertyPage.d.ts.map +1 -1
- package/dist/editorUtils/editableInPropertyPage.js +2 -2
- package/dist/editorUtils/editableInPropertyPage.js.map +1 -1
- package/dist/editorUtils/index.d.ts +1 -0
- package/dist/editorUtils/index.d.ts.map +1 -1
- package/dist/editorUtils/index.js +2 -0
- package/dist/editorUtils/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/optimization/dependencyGraph.js.map +1 -1
- package/dist/optimization/optimizedShaderBlock.d.ts +4 -4
- package/dist/optimization/optimizedShaderBlock.d.ts.map +1 -1
- package/dist/optimization/optimizedShaderBlock.js.map +1 -1
- package/dist/optimization/smartFilterOptimizer.d.ts +2 -2
- package/dist/optimization/smartFilterOptimizer.d.ts.map +1 -1
- package/dist/optimization/smartFilterOptimizer.js +34 -57
- package/dist/optimization/smartFilterOptimizer.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +3 -3
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/renderTargetGenerator.d.ts +1 -1
- package/dist/runtime/renderTargetGenerator.d.ts.map +1 -1
- package/dist/runtime/renderTargetGenerator.js +5 -7
- package/dist/runtime/renderTargetGenerator.js.map +1 -1
- package/dist/runtime/shaderRuntime.d.ts +7 -7
- package/dist/runtime/shaderRuntime.d.ts.map +1 -1
- package/dist/runtime/shaderRuntime.js +7 -8
- package/dist/runtime/shaderRuntime.js.map +1 -1
- package/dist/runtime/smartFilterRuntime.d.ts +3 -3
- package/dist/runtime/smartFilterRuntime.d.ts.map +1 -1
- package/dist/runtime/smartFilterRuntime.js.map +1 -1
- package/dist/runtime/strongRef.d.ts +1 -1
- package/dist/runtime/strongRef.js +1 -1
- package/dist/serialization/importCustomBlockDefinition.d.ts +1 -1
- package/dist/serialization/importCustomBlockDefinition.js +8 -9
- package/dist/serialization/importCustomBlockDefinition.js.map +1 -1
- package/dist/serialization/index.d.ts +1 -0
- package/dist/serialization/index.d.ts.map +1 -1
- package/dist/serialization/index.js +3 -0
- package/dist/serialization/index.js.map +1 -1
- package/dist/serialization/serializedBlockDefinition.d.ts +2 -2
- package/dist/serialization/serializedBlockDefinition.d.ts.map +1 -1
- package/dist/serialization/serializedShaderBlockDefinition.d.ts +1 -1
- package/dist/serialization/serializedShaderBlockDefinition.d.ts.map +1 -1
- package/dist/serialization/serializedSmartFilter.d.ts +1 -1
- package/dist/serialization/serializedSmartFilter.d.ts.map +1 -1
- package/dist/serialization/smartFilterDeserializer.d.ts +6 -6
- package/dist/serialization/smartFilterDeserializer.d.ts.map +1 -1
- package/dist/serialization/smartFilterDeserializer.js +9 -12
- package/dist/serialization/smartFilterDeserializer.js.map +1 -1
- package/dist/serialization/smartFilterSerializer.d.ts +2 -2
- package/dist/serialization/smartFilterSerializer.d.ts.map +1 -1
- package/dist/serialization/smartFilterSerializer.js +10 -13
- package/dist/serialization/smartFilterSerializer.js.map +1 -1
- package/dist/serialization/v1/defaultBlockSerializer.d.ts +2 -2
- package/dist/serialization/v1/defaultBlockSerializer.d.ts.map +1 -1
- package/dist/serialization/v1/defaultBlockSerializer.js +1 -1
- package/dist/serialization/v1/index.d.ts +1 -0
- package/dist/serialization/v1/index.d.ts.map +1 -1
- package/dist/serialization/v1/index.js +2 -0
- package/dist/serialization/v1/index.js.map +1 -1
- package/dist/serialization/v1/shaderBlockSerialization.types.d.ts +3 -3
- package/dist/serialization/v1/shaderBlockSerialization.types.d.ts.map +1 -1
- package/dist/serialization/v1/smartFilterSerialization.types.d.ts +2 -2
- package/dist/serialization/v1/smartFilterSerialization.types.d.ts.map +1 -1
- package/dist/smartFilter.d.ts +8 -8
- package/dist/smartFilter.d.ts.map +1 -1
- package/dist/smartFilter.js +6 -7
- package/dist/smartFilter.js.map +1 -1
- package/dist/utils/buildTools/buildShaders.d.ts +3 -2
- package/dist/utils/buildTools/buildShaders.d.ts.map +1 -1
- package/dist/utils/buildTools/buildShaders.js +7 -6
- package/dist/utils/buildTools/buildShaders.js.map +1 -1
- package/dist/utils/buildTools/convertGlslIntoBlock.d.ts +4 -2
- package/dist/utils/buildTools/convertGlslIntoBlock.d.ts.map +1 -1
- package/dist/utils/buildTools/convertGlslIntoBlock.js +136 -141
- package/dist/utils/buildTools/convertGlslIntoBlock.js.map +1 -1
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.d.ts +4 -4
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.d.ts.map +1 -1
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.js +55 -48
- package/dist/utils/buildTools/convertGlslIntoShaderProgram.js.map +1 -1
- package/dist/utils/buildTools/convertShaders.d.ts +8 -5
- package/dist/utils/buildTools/convertShaders.d.ts.map +1 -1
- package/dist/utils/buildTools/convertShaders.js +38 -14
- package/dist/utils/buildTools/convertShaders.js.map +1 -1
- package/dist/utils/buildTools/shaderConverter.d.ts +4 -4
- package/dist/utils/buildTools/shaderConverter.d.ts.map +1 -1
- package/dist/utils/buildTools/shaderConverter.js +17 -21
- package/dist/utils/buildTools/shaderConverter.js.map +1 -1
- package/dist/utils/buildTools/watchShaders.d.ts +3 -2
- package/dist/utils/buildTools/watchShaders.d.ts.map +1 -1
- package/dist/utils/buildTools/watchShaders.js +10 -8
- package/dist/utils/buildTools/watchShaders.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/renderTargetUtils.d.ts +3 -3
- package/dist/utils/renderTargetUtils.d.ts.map +1 -1
- package/dist/utils/renderTargetUtils.js +4 -4
- package/dist/utils/renderTargetUtils.js.map +1 -1
- package/dist/utils/shaderCodeUtils.d.ts +8 -8
- package/dist/utils/shaderCodeUtils.d.ts.map +1 -1
- package/dist/utils/shaderCodeUtils.js +16 -28
- package/dist/utils/shaderCodeUtils.js.map +1 -1
- package/dist/utils/textureLoaders.d.ts +2 -2
- package/dist/utils/textureLoaders.d.ts.map +1 -1
- package/dist/utils/textureLoaders.js +2 -3
- package/dist/utils/textureLoaders.js.map +1 -1
- package/dist/utils/textureUtils.d.ts +5 -5
- package/dist/utils/textureUtils.d.ts.map +1 -1
- package/dist/utils/textureUtils.js +1 -1
- package/dist/utils/textureUtils.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/license.md +21 -21
- package/package.json +13 -8
- package/src/blockFoundation/aggregateBlock.ts +148 -151
- package/src/blockFoundation/baseBlock.ts +339 -364
- package/src/blockFoundation/customAggregateBlock.ts +88 -104
- package/src/blockFoundation/customShaderBlock.ts +312 -326
- package/src/blockFoundation/disableableShaderBlock.ts +91 -100
- package/src/blockFoundation/index.ts +9 -9
- package/src/blockFoundation/inputBlock.deserializer.ts +72 -97
- package/src/blockFoundation/inputBlock.serialization.types.ts +126 -132
- package/src/blockFoundation/inputBlock.serializer.ts +150 -150
- package/src/blockFoundation/inputBlock.ts +181 -192
- package/src/blockFoundation/outputBlock.ts +144 -151
- package/src/blockFoundation/shaderBlock.ts +156 -163
- package/src/blockFoundation/textureOptions.ts +57 -57
- package/src/command/command.ts +59 -59
- package/src/command/commandBuffer.ts +71 -71
- package/src/command/commandBufferDebugger.ts +14 -14
- package/src/command/index.ts +7 -3
- package/src/connection/connectionPoint.ts +205 -214
- package/src/connection/connectionPointCompatibilityState.ts +31 -31
- package/src/connection/connectionPointType.ts +45 -45
- package/src/connection/connectionPointWithDefault.ts +27 -35
- package/src/connection/index.ts +8 -9
- package/src/editorUtils/editableInPropertyPage.ts +106 -106
- package/src/editorUtils/index.ts +3 -1
- package/src/index.ts +16 -15
- package/src/optimization/dependencyGraph.ts +96 -96
- package/src/optimization/index.ts +1 -1
- package/src/optimization/optimizedShaderBlock.ts +131 -134
- package/src/optimization/smartFilterOptimizer.ts +757 -825
- package/src/runtime/index.ts +8 -6
- package/src/runtime/renderTargetGenerator.ts +222 -248
- package/src/runtime/shaderRuntime.ts +174 -173
- package/src/runtime/smartFilterRuntime.ts +112 -112
- package/src/runtime/strongRef.ts +18 -18
- package/src/serialization/importCustomBlockDefinition.ts +86 -86
- package/src/serialization/index.ts +10 -7
- package/src/serialization/serializedBlockDefinition.ts +12 -12
- package/src/serialization/serializedShaderBlockDefinition.ts +7 -7
- package/src/serialization/serializedSmartFilter.ts +6 -6
- package/src/serialization/smartFilterDeserializer.ts +190 -220
- package/src/serialization/smartFilterSerializer.ts +110 -121
- package/src/serialization/v1/defaultBlockSerializer.ts +21 -21
- package/src/serialization/v1/index.ts +4 -2
- package/src/serialization/v1/shaderBlockSerialization.types.ts +85 -85
- package/src/serialization/v1/smartFilterSerialization.types.ts +129 -133
- package/src/smartFilter.ts +255 -260
- package/src/utils/buildTools/buildShaders.ts +14 -13
- package/src/utils/buildTools/convertGlslIntoBlock.ts +370 -385
- package/src/utils/buildTools/convertGlslIntoShaderProgram.ts +173 -172
- package/src/utils/buildTools/convertShaders.ts +65 -43
- package/src/utils/buildTools/recordVersionNumber.js +17 -0
- package/src/utils/buildTools/shaderConverter.ts +466 -478
- package/src/utils/buildTools/watchShaders.ts +44 -42
- package/src/utils/index.ts +4 -2
- package/src/utils/renderTargetUtils.ts +30 -35
- package/src/utils/shaderCodeUtils.ts +192 -207
- package/src/utils/textureLoaders.ts +31 -43
- package/src/utils/textureUtils.ts +28 -32
- package/src/version.ts +2 -2
- package/dist/utils/buildTools/determineVersion.d.ts +0 -36
- package/dist/utils/buildTools/determineVersion.d.ts.map +0 -1
- package/dist/utils/buildTools/determineVersion.js +0 -109
- package/dist/utils/buildTools/determineVersion.js.map +0 -1
- package/dist/utils/buildTools/versionUp.d.ts +0 -2
- package/dist/utils/buildTools/versionUp.d.ts.map +0 -1
- package/dist/utils/buildTools/versionUp.js +0 -53
- package/dist/utils/buildTools/versionUp.js.map +0 -1
- package/src/utils/buildTools/determineVersion.ts +0 -128
- package/src/utils/buildTools/versionUp.ts +0 -61
|
@@ -1,192 +1,181 @@
|
|
|
1
|
-
import type { SmartFilter } from "../smartFilter";
|
|
2
|
-
import type { ConnectionPointValue } from "../connection/connectionPointType";
|
|
3
|
-
import type { RuntimeData } from "../connection/connectionPoint";
|
|
4
|
-
import type { ConnectionPointWithDefault } from "../connection/connectionPointWithDefault";
|
|
5
|
-
import type { DisableableShaderBlock } from "./disableableShaderBlock";
|
|
6
|
-
import { BaseBlock } from "./baseBlock.js";
|
|
7
|
-
import {
|
|
8
|
-
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
9
|
-
import type { Nullable } from "
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Type predicate to check if value is a strong ref or a direct value
|
|
13
|
-
* @param value - The value to check
|
|
14
|
-
* @returns true if the value is a strong ref, otherwise false
|
|
15
|
-
*/
|
|
16
|
-
function
|
|
17
|
-
value
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
* This
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
*
|
|
156
|
-
* @param
|
|
157
|
-
* @param
|
|
158
|
-
* @
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
type:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
this.runtimeValue = createStrongRef(initialValue);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Unionized type of all the possible input types.
|
|
189
|
-
*/
|
|
190
|
-
export type AnyInputBlock = {
|
|
191
|
-
[T in keyof typeof ConnectionPointType]: InputBlock<(typeof ConnectionPointType)[T]>;
|
|
192
|
-
}[keyof typeof ConnectionPointType];
|
|
1
|
+
import type { SmartFilter } from "../smartFilter.js";
|
|
2
|
+
import type { ConnectionPointValue } from "../connection/connectionPointType.js";
|
|
3
|
+
import type { RuntimeData } from "../connection/connectionPoint.js";
|
|
4
|
+
import type { ConnectionPointWithDefault } from "../connection/connectionPointWithDefault.js";
|
|
5
|
+
import type { DisableableShaderBlock } from "./disableableShaderBlock.js";
|
|
6
|
+
import { BaseBlock } from "./baseBlock.js";
|
|
7
|
+
import { CreateStrongRef } from "../runtime/strongRef.js";
|
|
8
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
9
|
+
import type { Nullable } from "core/types.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Type predicate to check if value is a strong ref or a direct value
|
|
13
|
+
* @param value - The value to check
|
|
14
|
+
* @returns true if the value is a strong ref, otherwise false
|
|
15
|
+
*/
|
|
16
|
+
function IsRuntimeData<U extends ConnectionPointType>(value: ConnectionPointValue<U> | RuntimeData<U>): value is RuntimeData<U> {
|
|
17
|
+
return value && (value as RuntimeData<ConnectionPointType>).value !== undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Predicate to check if a block is a texture input block.
|
|
22
|
+
* @param block - The block to check
|
|
23
|
+
* @returns true if the block is a texture input block, otherwise false
|
|
24
|
+
*/
|
|
25
|
+
export function IsTextureInputBlock(block: BaseBlock): block is InputBlock<ConnectionPointType.Texture> {
|
|
26
|
+
return (block as InputBlock<ConnectionPointType.Texture>).type === ConnectionPointType.Texture;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Predicate to check if a block is a disableable block.
|
|
31
|
+
* @param block - The block to check
|
|
32
|
+
* @returns true if the block is a disableable block, otherwise false
|
|
33
|
+
*/
|
|
34
|
+
export function IsDisableableShaderBlock(block: BaseBlock): block is DisableableShaderBlock {
|
|
35
|
+
return (block as DisableableShaderBlock).disabled !== undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* This base class exists to provide a type that the serializer can use to represent
|
|
40
|
+
* any InputBlock without knowing the exact type it is.
|
|
41
|
+
*/
|
|
42
|
+
export abstract class InputBlockBase extends BaseBlock {
|
|
43
|
+
/**
|
|
44
|
+
* The class name of the block.
|
|
45
|
+
*/
|
|
46
|
+
public static override ClassName = "InputBlock";
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The type of the input.
|
|
50
|
+
*/
|
|
51
|
+
public abstract readonly type: ConnectionPointType;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Describes the editor data that can be stored with an InputBlock of a given type.
|
|
56
|
+
*/
|
|
57
|
+
export type InputBlockEditorData<T extends ConnectionPointType> = T extends ConnectionPointType.Texture
|
|
58
|
+
? {
|
|
59
|
+
/**
|
|
60
|
+
* The URL of the texture, or default if null.
|
|
61
|
+
*/
|
|
62
|
+
url: Nullable<string>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* If supplied, gives a hint as to which type of texture the URL points to.
|
|
66
|
+
* Default is assumed to be "image"
|
|
67
|
+
*/
|
|
68
|
+
urlTypeHint: Nullable<"image" | "video">;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The anisotropic filtering level of the texture, or default if null.
|
|
72
|
+
*/
|
|
73
|
+
anisotropicFilteringLevel: Nullable<number>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Whether the Y axis should be flipped, or default if null.
|
|
77
|
+
*/
|
|
78
|
+
flipY: Nullable<boolean>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The file extension to use, or default if null.
|
|
82
|
+
*/
|
|
83
|
+
forcedExtension: Nullable<string>;
|
|
84
|
+
}
|
|
85
|
+
: T extends ConnectionPointType.Float
|
|
86
|
+
? {
|
|
87
|
+
/**
|
|
88
|
+
* If supplied, how this should be animated by the editor. Will not affect runtime behavior.
|
|
89
|
+
*/
|
|
90
|
+
animationType: Nullable<"time">;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* If supplied, the amount to change the value per millisecond when animating.
|
|
94
|
+
*/
|
|
95
|
+
valueDeltaPerMs: Nullable<number>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The minimum value of the float, used for slider control.
|
|
99
|
+
*/
|
|
100
|
+
min: Nullable<number>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The maximum value of the float, used for slider control.
|
|
104
|
+
*/
|
|
105
|
+
max: Nullable<number>;
|
|
106
|
+
}
|
|
107
|
+
: {};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* This represents any inputs used in the graph.
|
|
111
|
+
*
|
|
112
|
+
* This is used to provide a way to connect the graph to the outside world.
|
|
113
|
+
*
|
|
114
|
+
* The value is dynamically set by the user.
|
|
115
|
+
*/
|
|
116
|
+
export class InputBlock<U extends ConnectionPointType, V = unknown> extends InputBlockBase {
|
|
117
|
+
/**
|
|
118
|
+
* The output connection point of the block.
|
|
119
|
+
*/
|
|
120
|
+
public readonly output: ConnectionPointWithDefault<U>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The type of the input.
|
|
124
|
+
*/
|
|
125
|
+
public readonly type: U;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Data used by the Editor to store options required for instantiating the block in the Editor.
|
|
129
|
+
*/
|
|
130
|
+
public editorData: Nullable<InputBlockEditorData<U>> = null;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Metadata the hosting app wants to track for this input. For example, a hint for what data to
|
|
134
|
+
* assign to this input, or hints about how to draw dynamic UI to allow users to control this value.
|
|
135
|
+
*/
|
|
136
|
+
public appMetadata: Nullable<V> = null;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Gets the current value of the input.
|
|
140
|
+
*/
|
|
141
|
+
public get runtimeValue(): RuntimeData<U> {
|
|
142
|
+
return this.output.runtimeData;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Sets the current value of the input.
|
|
147
|
+
*/
|
|
148
|
+
public set runtimeValue(value: RuntimeData<U>) {
|
|
149
|
+
this.output.runtimeData = value;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Creates a new InputBlock.
|
|
154
|
+
* @param smartFilter - The smart filter to add the block to
|
|
155
|
+
* @param name - The friendly name of the block
|
|
156
|
+
* @param type - The type of the input
|
|
157
|
+
* @param initialValue - The initial value of the input
|
|
158
|
+
* @remarks the initial value can either be a strong reference or a value
|
|
159
|
+
*/
|
|
160
|
+
constructor(smartFilter: SmartFilter, name: string, type: U, initialValue: ConnectionPointValue<U> | RuntimeData<U>) {
|
|
161
|
+
super(smartFilter, name);
|
|
162
|
+
this.type = type;
|
|
163
|
+
|
|
164
|
+
// Creates the output connection point
|
|
165
|
+
this.output = this._registerOutputWithDefault("output", type, IsRuntimeData(initialValue) ? initialValue : CreateStrongRef(initialValue));
|
|
166
|
+
|
|
167
|
+
// Creates a strong reference to the initial value in case a reference has not been provided
|
|
168
|
+
if (IsRuntimeData(initialValue)) {
|
|
169
|
+
this.runtimeValue = initialValue;
|
|
170
|
+
} else {
|
|
171
|
+
this.runtimeValue = CreateStrongRef(initialValue);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Unionized type of all the possible input types.
|
|
178
|
+
*/
|
|
179
|
+
export type AnyInputBlock = {
|
|
180
|
+
[T in keyof typeof ConnectionPointType]: InputBlock<(typeof ConnectionPointType)[T]>;
|
|
181
|
+
}[keyof typeof ConnectionPointType];
|