@babylonjs/smart-filters 1.0.13 → 8.19.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 +9 -0
- package/dist/blockFoundation/customShaderBlock.d.ts.map +1 -1
- package/dist/blockFoundation/customShaderBlock.js +47 -7
- 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 +362 -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 +24 -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,214 +1,205 @@
|
|
|
1
|
-
import type { Nullable } from "
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
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
|
-
* @param
|
|
71
|
-
* @param
|
|
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
|
-
public
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
return ConnectionPointCompatibilityState.Compatible;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
*
|
|
142
|
-
* @param
|
|
143
|
-
* @
|
|
144
|
-
*/
|
|
145
|
-
public
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
//
|
|
187
|
-
endpoint
|
|
188
|
-
endpoint
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this.
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (!this.runtimeData) {
|
|
207
|
-
this.runtimeData = {} as RuntimeData<U>;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
for (const endpoint of this.endpoints) {
|
|
211
|
-
endpoint.runtimeData = this.runtimeData;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
1
|
+
import type { Nullable } from "core/types.js";
|
|
2
|
+
import { ConnectionPointCompatibilityState, GetCompatibilityIssueMessage } from "./connectionPointCompatibilityState.js";
|
|
3
|
+
import { ConnectionPointDirection } from "./connectionPointDirection.js";
|
|
4
|
+
import type { BaseBlock } from "../blockFoundation/baseBlock.js";
|
|
5
|
+
import type { ConnectionPointType, ConnectionPointValue } from "./connectionPointType.js";
|
|
6
|
+
import type { StrongRef } from "../runtime/strongRef.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This represents a strong reference to the data being passed through a connection point.
|
|
10
|
+
*/
|
|
11
|
+
export type RuntimeData<U extends ConnectionPointType> = StrongRef<ConnectionPointValue<U>>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This defines a connection point.
|
|
15
|
+
*
|
|
16
|
+
* A connection point is any input/output of a block.
|
|
17
|
+
* It can be linked to another connection point following some rules:
|
|
18
|
+
* - The type of the connection point must be compatible with the other one.
|
|
19
|
+
* - The direction of the connection point must be different from the other one.
|
|
20
|
+
* - The connection cannot create a cycle in the list of blocks.
|
|
21
|
+
* The relationship is always 1:N for input:output
|
|
22
|
+
*/
|
|
23
|
+
export class ConnectionPoint<U extends ConnectionPointType = ConnectionPointType> {
|
|
24
|
+
/**
|
|
25
|
+
* The name of the connection point.
|
|
26
|
+
* This is used to identify the connection point inside a block.
|
|
27
|
+
*/
|
|
28
|
+
public readonly name: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The type of the connection point (float, texture, etc.)
|
|
32
|
+
*/
|
|
33
|
+
public readonly type: U;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The direction of the connection point (input or output)
|
|
37
|
+
*/
|
|
38
|
+
public readonly direction: ConnectionPointDirection;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The smart filter block the connection point belongs to.
|
|
42
|
+
*/
|
|
43
|
+
public readonly ownerBlock: BaseBlock;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* User provided name for the connection point.
|
|
47
|
+
*/
|
|
48
|
+
public displayName: Nullable<string> = null;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The @see RunTimeData used during the init phase to reference the result of the previous block.
|
|
52
|
+
* Those are only used for input connection points.
|
|
53
|
+
* The previous block are "pushing" this in during the init stage.
|
|
54
|
+
*/
|
|
55
|
+
public runtimeData: Nullable<RuntimeData<U>> = null;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The default runtimeData used when no connection is made to the connection point.
|
|
59
|
+
*/
|
|
60
|
+
public readonly defaultRuntimeData: Nullable<RuntimeData<U>> = null;
|
|
61
|
+
|
|
62
|
+
private _connectedTo: Nullable<ConnectionPoint<U>> = null;
|
|
63
|
+
private _endpoints: Array<ConnectionPoint<U>> = [];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Create a new connection point.
|
|
67
|
+
* @param name - The name the connection point has in the block
|
|
68
|
+
* @param ownerBlock - The block the connection point belongs to
|
|
69
|
+
* @param type - The type of the connection point
|
|
70
|
+
* @param direction - The direction of the connection point
|
|
71
|
+
* @param defaultRuntimeData - The default runtime data to use when no connection is made to the connection point
|
|
72
|
+
*/
|
|
73
|
+
constructor(name: string, ownerBlock: BaseBlock, type: U, direction: ConnectionPointDirection, defaultRuntimeData: Nullable<RuntimeData<U>> = null) {
|
|
74
|
+
this.name = name;
|
|
75
|
+
this.ownerBlock = ownerBlock;
|
|
76
|
+
this.type = type;
|
|
77
|
+
this.direction = direction;
|
|
78
|
+
this.defaultRuntimeData = defaultRuntimeData;
|
|
79
|
+
this.runtimeData = defaultRuntimeData;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @returns The connection point this connection point is connected to.
|
|
84
|
+
* (the one on the other side of the connection)
|
|
85
|
+
* Only input connection points have a connected point which they received their value from.
|
|
86
|
+
* (Relation is always 1:N for input:output)
|
|
87
|
+
*/
|
|
88
|
+
public get connectedTo(): Nullable<ConnectionPoint<U>> {
|
|
89
|
+
return this._connectedTo;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @returns The connection points this output connection point is connected to.
|
|
94
|
+
* (the ones on the other side of the connection)
|
|
95
|
+
* Only output connection points have a list of endpoints which they provide their value to.
|
|
96
|
+
* (Relation is always 1:N for input:output)
|
|
97
|
+
*/
|
|
98
|
+
public get endpoints(): ReadonlyArray<ConnectionPoint<U>> {
|
|
99
|
+
return this._endpoints;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Gets a state indicating if the current point can be connected to another point
|
|
104
|
+
* @param other - defines the other connection point
|
|
105
|
+
* @returns the compatibility state
|
|
106
|
+
*/
|
|
107
|
+
public checkCompatibilityState(other: ConnectionPoint<U>): ConnectionPointCompatibilityState {
|
|
108
|
+
// Only connects output to input
|
|
109
|
+
if (this.direction === ConnectionPointDirection.Input) {
|
|
110
|
+
return other.checkCompatibilityState(this);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Check types
|
|
114
|
+
if (this.type !== other.type) {
|
|
115
|
+
return ConnectionPointCompatibilityState.TypeIncompatible;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Check directions
|
|
119
|
+
if (this.direction === other.direction) {
|
|
120
|
+
return ConnectionPointCompatibilityState.DirectionIncompatible;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Check hierarchy
|
|
124
|
+
if (other.ownerBlock.isAnAncestorOf(this.ownerBlock)) {
|
|
125
|
+
return ConnectionPointCompatibilityState.HierarchyIssue;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return ConnectionPointCompatibilityState.Compatible;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Checks if the connection point can be connected to another one.
|
|
133
|
+
* @param connectionPoint - The other connection point to check compatibility with
|
|
134
|
+
* @returns true if the connection point can be connected to the other one
|
|
135
|
+
*/
|
|
136
|
+
public canConnectTo(connectionPoint: ConnectionPoint<U>) {
|
|
137
|
+
return this.checkCompatibilityState(connectionPoint) === ConnectionPointCompatibilityState.Compatible;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Connect this connection point to another one.
|
|
142
|
+
* @param other - The other connection point to connect to
|
|
143
|
+
* @throws if the connection point cannot be connected to the other one
|
|
144
|
+
*/
|
|
145
|
+
public connectTo(other: ConnectionPoint<U>): void {
|
|
146
|
+
// Only connects output to input
|
|
147
|
+
if (this.direction === ConnectionPointDirection.Input) {
|
|
148
|
+
other.connectTo(this);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Check compatibility
|
|
153
|
+
const compatibility = this.checkCompatibilityState(other);
|
|
154
|
+
if (compatibility !== ConnectionPointCompatibilityState.Compatible) {
|
|
155
|
+
throw GetCompatibilityIssueMessage(compatibility);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Adds the connection point to the list of endpoints
|
|
159
|
+
this._endpoints.push(other);
|
|
160
|
+
// Fill at the same time the connectedTo property of the other connection point
|
|
161
|
+
other._connectedTo = this;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Disconnects this point from one of his endpoint
|
|
166
|
+
* @param endpoint - defines the other connection point
|
|
167
|
+
*/
|
|
168
|
+
public disconnectFrom(endpoint: ConnectionPoint<U>): void {
|
|
169
|
+
const index = this._endpoints.indexOf(endpoint);
|
|
170
|
+
if (index === -1) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Remove the connection point from the list of endpoints
|
|
175
|
+
this._endpoints.splice(index, 1);
|
|
176
|
+
|
|
177
|
+
// Connections are double-linked - remove the reference back to this connection point from the one we just disconnected from
|
|
178
|
+
endpoint._connectedTo = null;
|
|
179
|
+
endpoint.runtimeData = endpoint.defaultRuntimeData;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Disconnects this point from all its endpoints.
|
|
184
|
+
*/
|
|
185
|
+
public disconnectAllEndpoints(): void {
|
|
186
|
+
// Detach outputs
|
|
187
|
+
let endpoint: ConnectionPoint<U> | undefined;
|
|
188
|
+
while ((endpoint = this._endpoints[0])) {
|
|
189
|
+
this.disconnectFrom(endpoint);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Propagates the current runtime data to all endpoints.
|
|
195
|
+
*/
|
|
196
|
+
public propagateRuntimeData(): void {
|
|
197
|
+
if (!this.runtimeData) {
|
|
198
|
+
this.runtimeData = {} as RuntimeData<U>;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
for (const endpoint of this.endpoints) {
|
|
202
|
+
endpoint.runtimeData = this.runtimeData;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines how compatible connection points are.
|
|
3
|
-
*/
|
|
4
|
-
export enum ConnectionPointCompatibilityState {
|
|
5
|
-
/** Points are compatibles */
|
|
6
|
-
Compatible,
|
|
7
|
-
/** Points are incompatible because of their types */
|
|
8
|
-
TypeIncompatible,
|
|
9
|
-
/** Points are incompatible because of their directions */
|
|
10
|
-
DirectionIncompatible,
|
|
11
|
-
/** Points are incompatible because they are in the same hierarchy **/
|
|
12
|
-
HierarchyIssue,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Gets a user friendly message for the given compatibility state.
|
|
17
|
-
* @param state - Defines the compatibility state
|
|
18
|
-
* @returns the message associated with a compatibility state.
|
|
19
|
-
*/
|
|
20
|
-
export function
|
|
21
|
-
switch (state) {
|
|
22
|
-
case ConnectionPointCompatibilityState.TypeIncompatible:
|
|
23
|
-
return "Cannot connect two different connection types";
|
|
24
|
-
case ConnectionPointCompatibilityState.DirectionIncompatible:
|
|
25
|
-
return "Cannot connect with the same direction";
|
|
26
|
-
case ConnectionPointCompatibilityState.HierarchyIssue:
|
|
27
|
-
return "Source block cannot be connected with one of its ancestors";
|
|
28
|
-
default:
|
|
29
|
-
return "";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Defines how compatible connection points are.
|
|
3
|
+
*/
|
|
4
|
+
export enum ConnectionPointCompatibilityState {
|
|
5
|
+
/** Points are compatibles */
|
|
6
|
+
Compatible,
|
|
7
|
+
/** Points are incompatible because of their types */
|
|
8
|
+
TypeIncompatible,
|
|
9
|
+
/** Points are incompatible because of their directions */
|
|
10
|
+
DirectionIncompatible,
|
|
11
|
+
/** Points are incompatible because they are in the same hierarchy **/
|
|
12
|
+
HierarchyIssue,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Gets a user friendly message for the given compatibility state.
|
|
17
|
+
* @param state - Defines the compatibility state
|
|
18
|
+
* @returns the message associated with a compatibility state.
|
|
19
|
+
*/
|
|
20
|
+
export function GetCompatibilityIssueMessage(state: ConnectionPointCompatibilityState): string {
|
|
21
|
+
switch (state) {
|
|
22
|
+
case ConnectionPointCompatibilityState.TypeIncompatible:
|
|
23
|
+
return "Cannot connect two different connection types";
|
|
24
|
+
case ConnectionPointCompatibilityState.DirectionIncompatible:
|
|
25
|
+
return "Cannot connect with the same direction";
|
|
26
|
+
case ConnectionPointCompatibilityState.HierarchyIssue:
|
|
27
|
+
return "Source block cannot be connected with one of its ancestors";
|
|
28
|
+
default:
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import type { ThinTexture } from "
|
|
2
|
-
import type { IColor3Like, IColor4Like, IVector2Like } from "
|
|
3
|
-
import type { Nullable } from "
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Defines the type of a connection point.
|
|
7
|
-
*/
|
|
8
|
-
export enum ConnectionPointType {
|
|
9
|
-
/** Float */
|
|
10
|
-
Float = 1,
|
|
11
|
-
/** Texture */
|
|
12
|
-
Texture = 2,
|
|
13
|
-
/** Color3 */
|
|
14
|
-
Color3 = 3,
|
|
15
|
-
/** Color4 */
|
|
16
|
-
Color4 = 4,
|
|
17
|
-
/** Boolean */
|
|
18
|
-
Boolean = 5,
|
|
19
|
-
/** Vector2 */
|
|
20
|
-
Vector2 = 6,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* A union of all supported connection point types
|
|
25
|
-
*/
|
|
26
|
-
export type AllConnectionPointTypes =
|
|
27
|
-
| ConnectionPointType.Float
|
|
28
|
-
| ConnectionPointType.Texture
|
|
29
|
-
| ConnectionPointType.Color3
|
|
30
|
-
| ConnectionPointType.Color4
|
|
31
|
-
| ConnectionPointType.Boolean
|
|
32
|
-
| ConnectionPointType.Vector2;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves the type of the value from the Connection point type.
|
|
36
|
-
*/
|
|
37
|
-
// prettier-ignore
|
|
38
|
-
export type ConnectionPointValue<T extends ConnectionPointType = ConnectionPointType> =
|
|
39
|
-
T extends ConnectionPointType.Float ? number :
|
|
40
|
-
T extends ConnectionPointType.Texture ? Nullable<ThinTexture> :
|
|
41
|
-
T extends ConnectionPointType.Color3 ? IColor3Like :
|
|
42
|
-
T extends ConnectionPointType.Color4 ? IColor4Like :
|
|
43
|
-
T extends ConnectionPointType.Boolean ? boolean :
|
|
44
|
-
T extends ConnectionPointType.Vector2 ? IVector2Like :
|
|
45
|
-
never;
|
|
1
|
+
import type { ThinTexture } from "core/Materials/Textures/thinTexture.js";
|
|
2
|
+
import type { IColor3Like, IColor4Like, IVector2Like } from "core/Maths/math.like.js";
|
|
3
|
+
import type { Nullable } from "core/types.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Defines the type of a connection point.
|
|
7
|
+
*/
|
|
8
|
+
export enum ConnectionPointType {
|
|
9
|
+
/** Float */
|
|
10
|
+
Float = 1,
|
|
11
|
+
/** Texture */
|
|
12
|
+
Texture = 2,
|
|
13
|
+
/** Color3 */
|
|
14
|
+
Color3 = 3,
|
|
15
|
+
/** Color4 */
|
|
16
|
+
Color4 = 4,
|
|
17
|
+
/** Boolean */
|
|
18
|
+
Boolean = 5,
|
|
19
|
+
/** Vector2 */
|
|
20
|
+
Vector2 = 6,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A union of all supported connection point types
|
|
25
|
+
*/
|
|
26
|
+
export type AllConnectionPointTypes =
|
|
27
|
+
| ConnectionPointType.Float
|
|
28
|
+
| ConnectionPointType.Texture
|
|
29
|
+
| ConnectionPointType.Color3
|
|
30
|
+
| ConnectionPointType.Color4
|
|
31
|
+
| ConnectionPointType.Boolean
|
|
32
|
+
| ConnectionPointType.Vector2;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves the type of the value from the Connection point type.
|
|
36
|
+
*/
|
|
37
|
+
// prettier-ignore
|
|
38
|
+
export type ConnectionPointValue<T extends ConnectionPointType = ConnectionPointType> =
|
|
39
|
+
T extends ConnectionPointType.Float ? number :
|
|
40
|
+
T extends ConnectionPointType.Texture ? Nullable<ThinTexture> :
|
|
41
|
+
T extends ConnectionPointType.Color3 ? IColor3Like :
|
|
42
|
+
T extends ConnectionPointType.Color4 ? IColor4Like :
|
|
43
|
+
T extends ConnectionPointType.Boolean ? boolean :
|
|
44
|
+
T extends ConnectionPointType.Vector2 ? IVector2Like :
|
|
45
|
+
never;
|
|
@@ -1,35 +1,27 @@
|
|
|
1
|
-
import type { BaseBlock } from "../blockFoundation/baseBlock";
|
|
2
|
-
import { ConnectionPoint, type RuntimeData } from "./connectionPoint.js";
|
|
3
|
-
import type { ConnectionPointDirection } from "./connectionPointDirection";
|
|
4
|
-
import type { ConnectionPointType } from "./connectionPointType";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* A ConnectionPoint whose runtimeData is never null - if not hooked up to a connection, it will use a default value.
|
|
8
|
-
*/
|
|
9
|
-
export class ConnectionPointWithDefault<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
type: U,
|
|
29
|
-
direction: ConnectionPointDirection,
|
|
30
|
-
runtimeData: RuntimeData<U>
|
|
31
|
-
) {
|
|
32
|
-
super(name, ownerBlock, type, direction, runtimeData);
|
|
33
|
-
this.runtimeData = runtimeData;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
import type { BaseBlock } from "../blockFoundation/baseBlock.js";
|
|
2
|
+
import { ConnectionPoint, type RuntimeData } from "./connectionPoint.js";
|
|
3
|
+
import type { ConnectionPointDirection } from "./connectionPointDirection.js";
|
|
4
|
+
import type { ConnectionPointType } from "./connectionPointType.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A ConnectionPoint whose runtimeData is never null - if not hooked up to a connection, it will use a default value.
|
|
8
|
+
*/
|
|
9
|
+
export class ConnectionPointWithDefault<U extends ConnectionPointType = ConnectionPointType> extends ConnectionPoint<U> {
|
|
10
|
+
/**
|
|
11
|
+
* The runtime data for this ConnectionPoint - it will never be null - if not hooked up to a connection, it will use the default value.
|
|
12
|
+
*/
|
|
13
|
+
public override runtimeData: RuntimeData<U>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create a new ConnectionPointWithDefault
|
|
17
|
+
* @param name - The name the connection point has in the block
|
|
18
|
+
* @param ownerBlock - The block the connection point belongs to
|
|
19
|
+
* @param type - The type of the connection point
|
|
20
|
+
* @param direction - The direction of the connection point
|
|
21
|
+
* @param runtimeData - The runtimeData to use for this connection point if no connection is made
|
|
22
|
+
*/
|
|
23
|
+
constructor(name: string, ownerBlock: BaseBlock, type: U, direction: ConnectionPointDirection, runtimeData: RuntimeData<U>) {
|
|
24
|
+
super(name, ownerBlock, type, direction, runtimeData);
|
|
25
|
+
this.runtimeData = runtimeData;
|
|
26
|
+
}
|
|
27
|
+
}
|