@zephyr3d/scene 0.9.25 → 0.9.26
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/animation/hair/gpu_hair_simulation.js +1090 -0
- package/dist/animation/hair/gpu_hair_simulation.js.map +1 -0
- package/dist/animation/joint_dynamics/controller.js +7 -5
- package/dist/animation/joint_dynamics/controller.js.map +1 -1
- package/dist/animation/joint_dynamics/joint_dynamics_system.js +81 -5
- package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -1
- package/dist/animation/morphtrack.js +3 -4
- package/dist/animation/morphtrack.js.map +1 -1
- package/dist/animation/skeleton.js +58 -24
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/animation/spring/multi_chain_spring_system.js +577 -179
- package/dist/animation/spring/multi_chain_spring_system.js.map +1 -1
- package/dist/animation/spring/spring_collider.js +4 -3
- package/dist/animation/spring/spring_collider.js.map +1 -1
- package/dist/animation/spring/spring_node_pose_tracker.js +40 -0
- package/dist/animation/spring/spring_node_pose_tracker.js.map +1 -0
- package/dist/animation/spring/spring_particle.js +2 -0
- package/dist/animation/spring/spring_particle.js.map +1 -1
- package/dist/animation/spring/spring_system.js +11 -3
- package/dist/animation/spring/spring_system.js.map +1 -1
- package/dist/animation/spring_modifier.js +10 -0
- package/dist/animation/spring_modifier.js.map +1 -1
- package/dist/app/engine.js +53 -43
- package/dist/app/engine.js.map +1 -1
- package/dist/app/scriptingsystem.js +119 -6
- package/dist/app/scriptingsystem.js.map +1 -1
- package/dist/app/scriptregistry.js +3 -2
- package/dist/app/scriptregistry.js.map +1 -1
- package/dist/asset/assetmanager.js +284 -67
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/loaders/zhair/zhair_format.js +288 -0
- package/dist/asset/loaders/zhair/zhair_format.js.map +1 -0
- package/dist/asset/loaders/zhair/zhair_loader.js +221 -0
- package/dist/asset/loaders/zhair/zhair_loader.js.map +1 -0
- package/dist/asset/model.js +178 -67
- package/dist/asset/model.js.map +1 -1
- package/dist/camera/camera.js +193 -21
- package/dist/camera/camera.js.map +1 -1
- package/dist/camera/perspectivecamera.js +3 -1
- package/dist/camera/perspectivecamera.js.map +1 -1
- package/dist/index.d.ts +4019 -1278
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/material/eye.js +932 -0
- package/dist/material/eye.js.map +1 -0
- package/dist/material/hair.js +917 -0
- package/dist/material/hair.js.map +1 -0
- package/dist/material/hairstrand.js +842 -0
- package/dist/material/hairstrand.js.map +1 -0
- package/dist/material/hairstrand_data.js +162 -0
- package/dist/material/hairstrand_data.js.map +1 -0
- package/dist/material/lambert.js +5 -2
- package/dist/material/lambert.js.map +1 -1
- package/dist/material/material.js +338 -300
- package/dist/material/material.js.map +1 -1
- package/dist/material/meshmaterial.js +120 -19
- package/dist/material/meshmaterial.js.map +1 -1
- package/dist/material/mixins/albedocolor.js +1 -1
- package/dist/material/mixins/albedocolor.js.map +1 -1
- package/dist/material/mixins/lightmodel/blinnphong.js +5 -3
- package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
- package/dist/material/mixins/lightmodel/lambert.js +5 -4
- package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +3 -3
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +5 -5
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js +3 -3
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
- package/dist/material/mixins/lit.js +73 -18
- package/dist/material/mixins/lit.js.map +1 -1
- package/dist/material/mixins/pbr/common.js +4 -4
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/material/mixins/texture.js +48 -11
- package/dist/material/mixins/texture.js.map +1 -1
- package/dist/material/mtoon.js +6 -5
- package/dist/material/mtoon.js.map +1 -1
- package/dist/material/pbrblueprint.js +146 -28
- package/dist/material/pbrblueprint.js.map +1 -1
- package/dist/material/pbrblueprint_instance.js +501 -0
- package/dist/material/pbrblueprint_instance.js.map +1 -0
- package/dist/material/pbrmr.js +15 -16
- package/dist/material/pbrmr.js.map +1 -1
- package/dist/material/shader/helper.js +330 -20
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/shader/terrain_blend.js +55 -0
- package/dist/material/shader/terrain_blend.js.map +1 -0
- package/dist/material/skin.js +192 -32
- package/dist/material/skin.js.map +1 -1
- package/dist/material/spriteblueprint.js +16 -1
- package/dist/material/spriteblueprint.js.map +1 -1
- package/dist/material/subsurfaceprofile.js +86 -23
- package/dist/material/subsurfaceprofile.js.map +1 -1
- package/dist/material/water.js +3 -1
- package/dist/material/water.js.map +1 -1
- package/dist/posteffect/bloom.js +167 -7
- package/dist/posteffect/bloom.js.map +1 -1
- package/dist/posteffect/coloradjust.js +2 -1
- package/dist/posteffect/coloradjust.js.map +1 -1
- package/dist/posteffect/compositor.js.map +1 -1
- package/dist/posteffect/fxaa.js +2 -1
- package/dist/posteffect/fxaa.js.map +1 -1
- package/dist/posteffect/grayscale.js +3 -1
- package/dist/posteffect/grayscale.js.map +1 -1
- package/dist/posteffect/motionblur.js +4 -1
- package/dist/posteffect/motionblur.js.map +1 -1
- package/dist/posteffect/posteffect.js.map +1 -1
- package/dist/posteffect/skinsss.js +368 -69
- package/dist/posteffect/skinsss.js.map +1 -1
- package/dist/posteffect/ssgi.js +16 -9
- package/dist/posteffect/ssgi.js.map +1 -1
- package/dist/posteffect/ssr.js +3 -0
- package/dist/posteffect/ssr.js.map +1 -1
- package/dist/posteffect/sss.js +91 -34
- package/dist/posteffect/sss.js.map +1 -1
- package/dist/posteffect/taa.js.map +1 -1
- package/dist/posteffect/tonemap.js +44 -1
- package/dist/posteffect/tonemap.js.map +1 -1
- package/dist/render/abuffer_oit.js +45 -39
- package/dist/render/abuffer_oit.js.map +1 -1
- package/dist/render/cull_visitor.js +19 -0
- package/dist/render/cull_visitor.js.map +1 -1
- package/dist/render/depthpass.js +36 -2
- package/dist/render/depthpass.js.map +1 -1
- package/dist/render/drawable_mixin.js +26 -1
- package/dist/render/drawable_mixin.js.map +1 -1
- package/dist/render/dualdepthpeeling_oit.js +52 -51
- package/dist/render/dualdepthpeeling_oit.js.map +1 -1
- package/dist/render/envlight.js +1 -1
- package/dist/render/envlight.js.map +1 -1
- package/dist/render/fbm_wavegenerator.js +3 -0
- package/dist/render/fbm_wavegenerator.js.map +1 -1
- package/dist/render/gerstner_wavegenerator.js +3 -0
- package/dist/render/gerstner_wavegenerator.js.map +1 -1
- package/dist/render/globalbindgroup_allocator.js +3 -0
- package/dist/render/globalbindgroup_allocator.js.map +1 -1
- package/dist/render/oit.js +29 -0
- package/dist/render/oit.js.map +1 -0
- package/dist/render/render_queue.js +3 -0
- package/dist/render/render_queue.js.map +1 -1
- package/dist/render/rendergraph/device_pool_allocator.js.map +1 -1
- package/dist/render/rendergraph/executor.js +2 -0
- package/dist/render/rendergraph/executor.js.map +1 -1
- package/dist/render/rendergraph/forward_plus_builder.js +61 -1
- package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
- package/dist/render/rendergraph/rendergraph.js.map +1 -1
- package/dist/render/rendergraph/texture_affinity_cache.js +1 -1
- package/dist/render/rendergraph/texture_affinity_cache.js.map +1 -1
- package/dist/render/rendergraph/types.js.map +1 -1
- package/dist/render/shadow_mask_pass.js +73 -8
- package/dist/render/shadow_mask_pass.js.map +1 -1
- package/dist/render/sky.js +166 -126
- package/dist/render/sky.js.map +1 -1
- package/dist/render/weightedblended_oit.js +36 -35
- package/dist/render/weightedblended_oit.js.map +1 -1
- package/dist/scene/basesprite.js +8 -0
- package/dist/scene/basesprite.js.map +1 -1
- package/dist/scene/batchgroup.js +3 -0
- package/dist/scene/batchgroup.js.map +1 -1
- package/dist/scene/environment.js +4 -1
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/hair.js +963 -0
- package/dist/scene/hair.js.map +1 -0
- package/dist/scene/light.js +5 -1
- package/dist/scene/light.js.map +1 -1
- package/dist/scene/mesh.js +481 -47
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/meshdrawable.js +6 -0
- package/dist/scene/meshdrawable.js.map +1 -1
- package/dist/scene/msdftext.js +3 -0
- package/dist/scene/msdftext.js.map +1 -1
- package/dist/scene/msdftextsprite.js +3 -0
- package/dist/scene/msdftextsprite.js.map +1 -1
- package/dist/scene/particlesys.js +6 -0
- package/dist/scene/particlesys.js.map +1 -1
- package/dist/scene/scene.js +3 -0
- package/dist/scene/scene.js.map +1 -1
- package/dist/scene/scene_node.js +6 -1
- package/dist/scene/scene_node.js.map +1 -1
- package/dist/scene/terrain-cm/grass.js +3 -0
- package/dist/scene/terrain-cm/grass.js.map +1 -1
- package/dist/scene/terrain-cm/grassmaterial.js +3 -0
- package/dist/scene/terrain-cm/grassmaterial.js.map +1 -1
- package/dist/scene/terrain-cm/terrain-cm.js +6 -0
- package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
- package/dist/scene/terrain-cm/texture_cache.js +309 -0
- package/dist/scene/terrain-cm/texture_cache.js.map +1 -0
- package/dist/scene/water.js +6 -0
- package/dist/scene/water.js.map +1 -1
- package/dist/shaders/atmosphere.js.map +1 -1
- package/dist/shaders/diffusion.js +54 -0
- package/dist/shaders/diffusion.js.map +1 -0
- package/dist/shaders/shadow.js +33 -21
- package/dist/shaders/shadow.js.map +1 -1
- package/dist/shaders/temporal.js +71 -33
- package/dist/shaders/temporal.js.map +1 -1
- package/dist/shadow/dom.js +546 -0
- package/dist/shadow/dom.js.map +1 -0
- package/dist/shadow/pcf_opt.js +3 -5
- package/dist/shadow/pcf_opt.js.map +1 -1
- package/dist/shadow/pcf_pd.js +1 -1
- package/dist/shadow/pcf_pd.js.map +1 -1
- package/dist/shadow/receiver_bias.js +41 -0
- package/dist/shadow/receiver_bias.js.map +1 -0
- package/dist/shadow/shader.js +20 -60
- package/dist/shadow/shader.js.map +1 -1
- package/dist/shadow/shadow_impl.js +89 -0
- package/dist/shadow/shadow_impl.js.map +1 -1
- package/dist/shadow/shadow_region.js +50 -50
- package/dist/shadow/shadow_region.js.map +1 -1
- package/dist/shadow/shadowmapper.js +150 -37
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shapes/shape.js +11 -2
- package/dist/shapes/shape.js.map +1 -1
- package/dist/shapes/sphere.js +50 -9
- package/dist/shapes/sphere.js.map +1 -1
- package/dist/utility/blueprint/common/constants.js +112 -2
- package/dist/utility/blueprint/common/constants.js.map +1 -1
- package/dist/utility/blueprint/material/func.js +142 -49
- package/dist/utility/blueprint/material/func.js.map +1 -1
- package/dist/utility/blueprint/material/ir.js +490 -25
- package/dist/utility/blueprint/material/ir.js.map +1 -1
- package/dist/utility/blueprint/material/texture.js +898 -4
- package/dist/utility/blueprint/material/texture.js.map +1 -1
- package/dist/utility/serialization/manager.js +431 -100
- package/dist/utility/serialization/manager.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +370 -3
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/batch.js +4 -0
- package/dist/utility/serialization/scene/batch.js.map +1 -1
- package/dist/utility/serialization/scene/camera.js +133 -1
- package/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/utility/serialization/scene/common.js +26 -5
- package/dist/utility/serialization/scene/common.js.map +1 -1
- package/dist/utility/serialization/scene/hair.js +1141 -0
- package/dist/utility/serialization/scene/hair.js.map +1 -0
- package/dist/utility/serialization/scene/light.js +84 -4
- package/dist/utility/serialization/scene/light.js.map +1 -1
- package/dist/utility/serialization/scene/material.js +1867 -166
- package/dist/utility/serialization/scene/material.js.map +1 -1
- package/dist/utility/serialization/scene/mesh.js +231 -14
- package/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/utility/serialization/scene/node.js +141 -7
- package/dist/utility/serialization/scene/node.js.map +1 -1
- package/dist/utility/serialization/scene/particle.js +4 -0
- package/dist/utility/serialization/scene/particle.js.map +1 -1
- package/dist/utility/serialization/scene/primitive.js +18 -0
- package/dist/utility/serialization/scene/primitive.js.map +1 -1
- package/dist/utility/serialization/scene/sprite.js +4 -0
- package/dist/utility/serialization/scene/sprite.js.map +1 -1
- package/dist/utility/serialization/scene/terrain.js +4 -0
- package/dist/utility/serialization/scene/terrain.js.map +1 -1
- package/dist/utility/serialization/scene/text.js +4 -0
- package/dist/utility/serialization/scene/text.js.map +1 -1
- package/dist/utility/serialization/scene/water.js +4 -0
- package/dist/utility/serialization/scene/water.js.map +1 -1
- package/dist/utility/serialization/types.js.map +1 -1
- package/dist/utility/shprojector.js +96 -95
- package/dist/utility/shprojector.js.map +1 -1
- package/dist/values.js +49 -2
- package/dist/values.js.map +1 -1
- package/package.json +3 -3
|
@@ -2,6 +2,34 @@ import { objectKeys } from '@zephyr3d/base';
|
|
|
2
2
|
import { defineProps } from '../../serialization/types.js';
|
|
3
3
|
import { BaseGraphNode } from '../node.js';
|
|
4
4
|
|
|
5
|
+
const materialFunctionValueTypes = [
|
|
6
|
+
'float',
|
|
7
|
+
'vec2',
|
|
8
|
+
'vec3',
|
|
9
|
+
'vec4',
|
|
10
|
+
'mat2',
|
|
11
|
+
'mat3',
|
|
12
|
+
'mat4'
|
|
13
|
+
];
|
|
14
|
+
const materialFunctionInputTypes = [
|
|
15
|
+
...materialFunctionValueTypes,
|
|
16
|
+
'tex2D'
|
|
17
|
+
];
|
|
18
|
+
function compareMaterialFunctionInterfaceEntries(a, b) {
|
|
19
|
+
const aHasOrder = a.node.order >= 0;
|
|
20
|
+
const bHasOrder = b.node.order >= 0;
|
|
21
|
+
if (aHasOrder !== bHasOrder) {
|
|
22
|
+
return aHasOrder ? -1 : 1;
|
|
23
|
+
}
|
|
24
|
+
if (aHasOrder && a.node.order !== b.node.order) {
|
|
25
|
+
return a.node.order - b.node.order;
|
|
26
|
+
}
|
|
27
|
+
const nameOrder = a.node.name.localeCompare(b.node.name, 'en', {
|
|
28
|
+
numeric: true,
|
|
29
|
+
sensitivity: 'base'
|
|
30
|
+
});
|
|
31
|
+
return nameOrder || a.index - b.index;
|
|
32
|
+
}
|
|
5
33
|
/**
|
|
6
34
|
* Function call node for material blueprint functions
|
|
7
35
|
*
|
|
@@ -58,8 +86,9 @@ import { BaseGraphNode } from '../node.js';
|
|
|
58
86
|
* 2. Find all FunctionOutputNode instances and create output slots
|
|
59
87
|
* 3. Extract parameter names and types for validation
|
|
60
88
|
*
|
|
61
|
-
* Input/output slots
|
|
62
|
-
*
|
|
89
|
+
* Input/output slots use explicit interface order when present and otherwise
|
|
90
|
+
* sort naturally by name. Slot IDs retain their legacy nodeMap order so saved
|
|
91
|
+
* graph connections remain compatible.
|
|
63
92
|
*/ constructor(path, name, IR){
|
|
64
93
|
super();
|
|
65
94
|
this._path = path;
|
|
@@ -69,36 +98,60 @@ import { BaseGraphNode } from '../node.js';
|
|
|
69
98
|
this._outs = [];
|
|
70
99
|
this._inputs = [];
|
|
71
100
|
this._outputs = [];
|
|
101
|
+
const inputs = [];
|
|
102
|
+
const outputs = [];
|
|
72
103
|
for (const k of objectKeys(this._IR.DAG.nodeMap)){
|
|
73
104
|
const node = this._IR.DAG.nodeMap[k];
|
|
74
105
|
if (node instanceof FunctionInputNode) {
|
|
75
|
-
|
|
76
|
-
this._args.push({
|
|
106
|
+
inputs.push({
|
|
77
107
|
index: Number(k),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
});
|
|
81
|
-
this._inputs.push({
|
|
82
|
-
id: this._inputs.length + 1,
|
|
83
|
-
name,
|
|
84
|
-
type: [
|
|
85
|
-
node.type
|
|
86
|
-
]
|
|
108
|
+
slotId: inputs.length + 1,
|
|
109
|
+
node
|
|
87
110
|
});
|
|
88
111
|
} else if (node instanceof FunctionOutputNode) {
|
|
89
|
-
|
|
90
|
-
this._outs.push({
|
|
112
|
+
outputs.push({
|
|
91
113
|
index: Number(k),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
});
|
|
95
|
-
this._outputs.push({
|
|
96
|
-
id: this._outputs.length + 1,
|
|
97
|
-
name,
|
|
98
|
-
swizzle: name
|
|
114
|
+
slotId: outputs.length + 1,
|
|
115
|
+
node
|
|
99
116
|
});
|
|
100
117
|
}
|
|
101
118
|
}
|
|
119
|
+
inputs.sort(compareMaterialFunctionInterfaceEntries);
|
|
120
|
+
outputs.sort(compareMaterialFunctionInterfaceEntries);
|
|
121
|
+
for (const input of inputs){
|
|
122
|
+
const name = input.node.name || `arg_${input.index}`;
|
|
123
|
+
this._args.push({
|
|
124
|
+
index: input.index,
|
|
125
|
+
slotId: input.slotId,
|
|
126
|
+
name,
|
|
127
|
+
type: input.node.type
|
|
128
|
+
});
|
|
129
|
+
this._inputs.push({
|
|
130
|
+
id: input.slotId,
|
|
131
|
+
name,
|
|
132
|
+
type: [
|
|
133
|
+
input.node.type
|
|
134
|
+
]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
for (const output of outputs){
|
|
138
|
+
const name = output.node.name || `out_${output.index}`;
|
|
139
|
+
this._outs.push({
|
|
140
|
+
index: output.index,
|
|
141
|
+
slotId: output.slotId,
|
|
142
|
+
name,
|
|
143
|
+
type: output.node.type
|
|
144
|
+
});
|
|
145
|
+
this._outputs.push({
|
|
146
|
+
id: output.slotId,
|
|
147
|
+
name
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if (!(this._outs.length === 1 && this._outs[0].type === 'tex2D')) {
|
|
151
|
+
this._outputs.forEach((output, index)=>{
|
|
152
|
+
output.swizzle = this._outs[index].name;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
102
155
|
}
|
|
103
156
|
/**
|
|
104
157
|
* Gets the file path to the function blueprint
|
|
@@ -204,7 +257,7 @@ import { BaseGraphNode } from '../node.js';
|
|
|
204
257
|
* Returns the type declared by the corresponding FunctionOutputNode
|
|
205
258
|
* in the function's blueprint.
|
|
206
259
|
*/ getType(id) {
|
|
207
|
-
return this._outs
|
|
260
|
+
return this._outs.find((output)=>output.slotId === id).type;
|
|
208
261
|
}
|
|
209
262
|
}
|
|
210
263
|
/**
|
|
@@ -217,7 +270,8 @@ import { BaseGraphNode } from '../node.js';
|
|
|
217
270
|
*
|
|
218
271
|
* Each FunctionInputNode:
|
|
219
272
|
* - Has a name (parameter name)
|
|
220
|
-
* - Has a type (float, vec2, vec3, vec4, mat2, mat3, or
|
|
273
|
+
* - Has a type (float, vec2, vec3, vec4, mat2, mat3, mat4, or tex2D)
|
|
274
|
+
* - Has an optional explicit interface order (-1 sorts automatically by name)
|
|
221
275
|
* - Produces one output that provides the parameter value within the function
|
|
222
276
|
* - Has no inputs (it receives its value from the calling context)
|
|
223
277
|
*
|
|
@@ -242,6 +296,7 @@ import { BaseGraphNode } from '../node.js';
|
|
|
242
296
|
*/ class FunctionInputNode extends BaseGraphNode {
|
|
243
297
|
/** Static counter for auto-generating unique argument names */ static argId = 1;
|
|
244
298
|
/** The data type of this parameter */ _type;
|
|
299
|
+
/** Explicit interface order, or -1 to sort automatically by name */ _order;
|
|
245
300
|
/**
|
|
246
301
|
* Creates a new function input node
|
|
247
302
|
*
|
|
@@ -253,6 +308,7 @@ import { BaseGraphNode } from '../node.js';
|
|
|
253
308
|
*/ constructor(){
|
|
254
309
|
super();
|
|
255
310
|
this._type = 'vec4';
|
|
311
|
+
this._order = -1;
|
|
256
312
|
this._outputs = [
|
|
257
313
|
{
|
|
258
314
|
id: 1,
|
|
@@ -263,7 +319,7 @@ import { BaseGraphNode } from '../node.js';
|
|
|
263
319
|
/**
|
|
264
320
|
* Gets the parameter type
|
|
265
321
|
*
|
|
266
|
-
* @returns The data type (float, vec2, vec3, vec4, mat2, mat3, or
|
|
322
|
+
* @returns The data type (float, vec2, vec3, vec4, mat2, mat3, mat4, or tex2D)
|
|
267
323
|
*/ get type() {
|
|
268
324
|
return this._type;
|
|
269
325
|
}
|
|
@@ -279,13 +335,23 @@ import { BaseGraphNode } from '../node.js';
|
|
|
279
335
|
this._outputs[0].name = val;
|
|
280
336
|
}
|
|
281
337
|
}
|
|
338
|
+
/** Gets the explicit interface order, or -1 when automatic name sorting is used. */ get order() {
|
|
339
|
+
return this._order;
|
|
340
|
+
}
|
|
341
|
+
set order(val) {
|
|
342
|
+
const order = Number.isFinite(val) ? Math.max(-1, Math.trunc(val)) : -1;
|
|
343
|
+
if (this._order !== order) {
|
|
344
|
+
this._order = order;
|
|
345
|
+
this.dispatchEvent('changed');
|
|
346
|
+
}
|
|
347
|
+
}
|
|
282
348
|
/**
|
|
283
349
|
* Gets the serialization descriptor for this node type
|
|
284
350
|
*
|
|
285
351
|
* @returns Serialization class descriptor
|
|
286
352
|
*
|
|
287
353
|
* @remarks
|
|
288
|
-
* Serializes the parameter type and
|
|
354
|
+
* Serializes the parameter type, name, and interface order. The type has an enumeration
|
|
289
355
|
* constraint limited to valid shader types.
|
|
290
356
|
*/ static getSerializationCls() {
|
|
291
357
|
return {
|
|
@@ -299,22 +365,10 @@ import { BaseGraphNode } from '../node.js';
|
|
|
299
365
|
options: {
|
|
300
366
|
enum: {
|
|
301
367
|
labels: [
|
|
302
|
-
|
|
303
|
-
'vec2',
|
|
304
|
-
'vec3',
|
|
305
|
-
'vec4',
|
|
306
|
-
'mat2',
|
|
307
|
-
'mat3',
|
|
308
|
-
'mat4'
|
|
368
|
+
...materialFunctionInputTypes
|
|
309
369
|
],
|
|
310
370
|
values: [
|
|
311
|
-
|
|
312
|
-
'vec2',
|
|
313
|
-
'vec3',
|
|
314
|
-
'vec4',
|
|
315
|
-
'mat2',
|
|
316
|
-
'mat3',
|
|
317
|
-
'mat4'
|
|
371
|
+
...materialFunctionInputTypes
|
|
318
372
|
]
|
|
319
373
|
}
|
|
320
374
|
},
|
|
@@ -335,6 +389,22 @@ import { BaseGraphNode } from '../node.js';
|
|
|
335
389
|
this.name = value.str[0];
|
|
336
390
|
this.dispatchEvent('changed');
|
|
337
391
|
}
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
name: 'order',
|
|
395
|
+
type: 'int',
|
|
396
|
+
default: -1,
|
|
397
|
+
description: 'Interface order. Use -1 to sort automatically by name.',
|
|
398
|
+
options: {
|
|
399
|
+
minValue: -1,
|
|
400
|
+
speed: 1
|
|
401
|
+
},
|
|
402
|
+
get (value) {
|
|
403
|
+
value.num[0] = this._order;
|
|
404
|
+
},
|
|
405
|
+
set (value) {
|
|
406
|
+
this.order = value.num[0];
|
|
407
|
+
}
|
|
338
408
|
}
|
|
339
409
|
]);
|
|
340
410
|
}
|
|
@@ -375,6 +445,7 @@ import { BaseGraphNode } from '../node.js';
|
|
|
375
445
|
*
|
|
376
446
|
* Each FunctionOutputNode:
|
|
377
447
|
* - Has a name (output value name)
|
|
448
|
+
* - Has an optional explicit interface order (-1 sorts automatically by name)
|
|
378
449
|
* - Has one input that must be connected to compute the output value
|
|
379
450
|
* - Automatically determines its type from the connected input
|
|
380
451
|
* - Has no outputs (it provides its value to the calling context)
|
|
@@ -404,28 +475,24 @@ import { BaseGraphNode } from '../node.js';
|
|
|
404
475
|
* @public
|
|
405
476
|
*/ class FunctionOutputNode extends BaseGraphNode {
|
|
406
477
|
/** Static counter for auto-generating unique output names */ static outId = 1;
|
|
478
|
+
/** Explicit interface order, or -1 to sort automatically by name */ _order;
|
|
407
479
|
/**
|
|
408
480
|
* Creates a new function output node
|
|
409
481
|
*
|
|
410
482
|
* @remarks
|
|
411
483
|
* Initializes with:
|
|
412
484
|
* - Auto-generated name: out_N (where N is an incrementing counter)
|
|
413
|
-
* - One input slot that accepts
|
|
485
|
+
* - One input slot that accepts numeric/matrix values and tex2D
|
|
414
486
|
* - Type is inferred from the connected input node
|
|
415
487
|
*/ constructor(){
|
|
416
488
|
super();
|
|
489
|
+
this._order = -1;
|
|
417
490
|
this._inputs = [
|
|
418
491
|
{
|
|
419
492
|
id: 1,
|
|
420
493
|
name: `out_${FunctionOutputNode.outId++}`,
|
|
421
494
|
type: [
|
|
422
|
-
|
|
423
|
-
'vec2',
|
|
424
|
-
'vec3',
|
|
425
|
-
'vec4',
|
|
426
|
-
'mat2',
|
|
427
|
-
'mat3',
|
|
428
|
-
'mat4'
|
|
495
|
+
...materialFunctionInputTypes
|
|
429
496
|
]
|
|
430
497
|
}
|
|
431
498
|
];
|
|
@@ -442,6 +509,16 @@ import { BaseGraphNode } from '../node.js';
|
|
|
442
509
|
this._inputs[0].name = val;
|
|
443
510
|
}
|
|
444
511
|
}
|
|
512
|
+
/** Gets the explicit interface order, or -1 when automatic name sorting is used. */ get order() {
|
|
513
|
+
return this._order;
|
|
514
|
+
}
|
|
515
|
+
set order(val) {
|
|
516
|
+
const order = Number.isFinite(val) ? Math.max(-1, Math.trunc(val)) : -1;
|
|
517
|
+
if (this._order !== order) {
|
|
518
|
+
this._order = order;
|
|
519
|
+
this.dispatchEvent('changed');
|
|
520
|
+
}
|
|
521
|
+
}
|
|
445
522
|
/**
|
|
446
523
|
* Gets the output value type
|
|
447
524
|
*
|
|
@@ -458,7 +535,7 @@ import { BaseGraphNode } from '../node.js';
|
|
|
458
535
|
* @returns Serialization class descriptor
|
|
459
536
|
*
|
|
460
537
|
* @remarks
|
|
461
|
-
*
|
|
538
|
+
* Serializes the output name and interface order. The type is inferred at runtime
|
|
462
539
|
* from the connected input node.
|
|
463
540
|
*/ static getSerializationCls() {
|
|
464
541
|
return {
|
|
@@ -476,6 +553,22 @@ import { BaseGraphNode } from '../node.js';
|
|
|
476
553
|
this.name = value.str[0];
|
|
477
554
|
this.dispatchEvent('changed');
|
|
478
555
|
}
|
|
556
|
+
},
|
|
557
|
+
{
|
|
558
|
+
name: 'order',
|
|
559
|
+
type: 'int',
|
|
560
|
+
default: -1,
|
|
561
|
+
description: 'Interface order. Use -1 to sort automatically by name.',
|
|
562
|
+
options: {
|
|
563
|
+
minValue: -1,
|
|
564
|
+
speed: 1
|
|
565
|
+
},
|
|
566
|
+
get (value) {
|
|
567
|
+
value.num[0] = this._order;
|
|
568
|
+
},
|
|
569
|
+
set (value) {
|
|
570
|
+
this.order = value.num[0];
|
|
571
|
+
}
|
|
479
572
|
}
|
|
480
573
|
]);
|
|
481
574
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"func.js","sources":["../../../../src/utility/blueprint/material/func.ts"],"sourcesContent":["import { objectKeys } from '@zephyr3d/base';\r\nimport type { ResourceManager } from '../../serialization';\r\nimport { defineProps } from '../../serialization/types';\r\nimport { BaseGraphNode } from '../node';\r\nimport type { MaterialBlueprintIR } from './ir';\r\n\r\n/**\r\n * Function call node for material blueprint functions\r\n *\r\n * @remarks\r\n * Represents a call to a reusable material function (sub-graph) within the material node graph.\r\n * Functions are defined in separate blueprint files and can be instantiated multiple times.\r\n *\r\n * The node automatically:\r\n * - Discovers function inputs (FunctionInputNode) and creates corresponding input slots\r\n * - Discovers function outputs (FunctionOutputNode) and creates corresponding output slots\r\n * - Validates input types match the function's parameter types\r\n *\r\n * Benefits of using material functions:\r\n * - Code reuse across multiple materials\r\n * - Encapsulation of complex logic\r\n * - Easier maintenance (update function once, affects all uses)\r\n * - Better organization of large material graphs\r\n *\r\n * @example\r\n * ```typescript\r\n * // Load and instantiate a custom noise function\r\n * const noiseIR = await manager.loadBluePrint('functions/noise.mtlfunc');\r\n * const noiseCall = new FunctionCallNode(\r\n * 'functions/noise.mtlfunc',\r\n * 'noise',\r\n * noiseIR\r\n * );\r\n *\r\n * // Connect inputs\r\n * noiseCall.connectInput(1, uvNode, 1); // UV coordinates\r\n * noiseCall.connectInput(2, scaleNode, 1); // Scale parameter\r\n *\r\n * // Use outputs\r\n * colorNode.connectInput(1, noiseCall, 1); // Noise result\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport class FunctionCallNode extends BaseGraphNode {\r\n /** The file path to the function blueprint */\r\n private _name: string;\r\n /** The file path to the function blueprint */\r\n private _path: string;\r\n /** The intermediate representation (compiled graph) of the function */\r\n private _IR: MaterialBlueprintIR;\r\n /** Function input parameters with their indices, names, and types */\r\n private _args: { index: number; name: string; type: string }[];\r\n /** Function output values with their indices, names, and types */\r\n private _outs: { index: number; name: string; type: string }[];\r\n /**\r\n * Creates a new function call node\r\n *\r\n * @param path - The file path to the function blueprint\r\n * @param name - The display name of the function\r\n * @param IR - The compiled intermediate representation of the function\r\n *\r\n * @remarks\r\n * The constructor scans the function's IR to:\r\n * 1. Find all FunctionInputNode instances and create input slots\r\n * 2. Find all FunctionOutputNode instances and create output slots\r\n * 3. Extract parameter names and types for validation\r\n *\r\n * Input/output slots are created in the order they appear in the nodeMap,\r\n * using either custom names or auto-generated names like 'arg_N' or 'out_N'.\r\n */\r\n constructor(path: string, name: string, IR: MaterialBlueprintIR) {\r\n super();\r\n this._path = path;\r\n this._name = name;\r\n this._IR = IR;\r\n this._args = [];\r\n this._outs = [];\r\n this._inputs = [];\r\n this._outputs = [];\r\n for (const k of objectKeys(this._IR.DAG.nodeMap)) {\r\n const node = this._IR.DAG.nodeMap[k];\r\n if (node instanceof FunctionInputNode) {\r\n const name = node.name || `arg_${k}`;\r\n this._args.push({\r\n index: Number(k),\r\n name,\r\n type: node.type\r\n });\r\n this._inputs.push({\r\n id: this._inputs.length + 1,\r\n name,\r\n type: [node.type]\r\n });\r\n } else if (node instanceof FunctionOutputNode) {\r\n const name = node.name || `out_${k}`;\r\n this._outs.push({\r\n index: Number(k),\r\n name,\r\n type: node.type\r\n });\r\n this._outputs.push({\r\n id: this._outputs.length + 1,\r\n name,\r\n swizzle: name\r\n });\r\n }\r\n }\r\n }\r\n /**\r\n * Gets the file path to the function blueprint\r\n */\r\n get path() {\r\n return this._path;\r\n }\r\n /**\r\n * Gets the function name\r\n */\r\n get name() {\r\n return this._name;\r\n }\r\n /**\r\n * Gets the intermediate representation (IR) of the function\r\n *\r\n * @remarks\r\n * The IR contains the compiled node graph that will be inlined\r\n * or called during shader code generation.\r\n */\r\n get IR() {\r\n return this._IR;\r\n }\r\n /**\r\n * Gets the function's input parameter definitions\r\n *\r\n * @returns Array of parameter descriptors with index, name, and type\r\n */\r\n get args() {\r\n return this._args;\r\n }\r\n /**\r\n * Gets the function's output value definitions\r\n *\r\n * @returns Array of output descriptors with index, name, and type\r\n */\r\n get outs() {\r\n return this._outs;\r\n }\r\n /**\r\n * Gets the serialization descriptor for this node type\r\n *\r\n * @param manager - The serialization manager for loading blueprints\r\n * @returns Serialization class descriptor\r\n *\r\n * @remarks\r\n * Uses a custom createFunc to asynchronously load the function blueprint\r\n * from the file system. The initialization parameter is the blueprint path.\r\n */\r\n static getSerializationCls(manager: ResourceManager) {\r\n return {\r\n ctor: FunctionCallNode,\r\n name: 'FunctionCallNode',\r\n async createFunc(_: unknown, init: string) {\r\n const IR = await manager.loadBluePrint(init);\r\n const funcName = manager.VFS.basename(init, manager.VFS.extname(init));\r\n return { obj: new FunctionCallNode(init, funcName, IR!['func']) };\r\n },\r\n getInitParams(obj: FunctionCallNode) {\r\n return obj.path;\r\n },\r\n getProps() {\r\n return [];\r\n }\r\n };\r\n }\r\n /**\r\n * Generates a string representation of this node\r\n *\r\n * @returns The function name\r\n */\r\n toString() {\r\n return this._name;\r\n }\r\n /**\r\n * Validates the node state and input types\r\n *\r\n * @returns Error message if invalid, empty string if valid\r\n *\r\n * @remarks\r\n * Ensures:\r\n * - All required inputs are connected\r\n * - Input types can be determined\r\n * - Input types match the function's parameter types\r\n */\r\n protected validate() {\r\n for (let i = 0; i < this._inputs.length; i++) {\r\n const name = this._inputs[i].name;\r\n if (!this._inputs[i].inputNode) {\r\n return `Missing argument \\`${name}\\``;\r\n }\r\n const type = this._inputs[i].inputNode!.getOutputType(this._inputs[i].inputId!);\r\n if (!type) {\r\n return `Cannot determine type of argument \\`${name}\\``;\r\n }\r\n if (!this._inputs[i].type.includes(type)) {\r\n return `Invalid input type ${type}`;\r\n }\r\n }\r\n return '';\r\n }\r\n /**\r\n * Gets the output type for a specific output slot\r\n *\r\n * @param id - The output slot ID (1-based)\r\n * @returns The type of the output value\r\n *\r\n * @remarks\r\n * Returns the type declared by the corresponding FunctionOutputNode\r\n * in the function's blueprint.\r\n */\r\n protected getType(id: number) {\r\n return this._outs[id - 1].type;\r\n }\r\n}\r\n\r\n/**\r\n * Function input parameter node\r\n *\r\n * @remarks\r\n * Represents an input parameter in a material function blueprint.\r\n * These nodes define the function's interface - what data must be provided\r\n * when the function is called from another material graph.\r\n *\r\n * Each FunctionInputNode:\r\n * - Has a name (parameter name)\r\n * - Has a type (float, vec2, vec3, vec4, mat2, mat3, or mat4)\r\n * - Produces one output that provides the parameter value within the function\r\n * - Has no inputs (it receives its value from the calling context)\r\n *\r\n * When a FunctionCallNode is created, it scans for all FunctionInputNodes\r\n * and creates corresponding input slots on the call node.\r\n *\r\n * @example\r\n * ```typescript\r\n * // In a function blueprint:\r\n * const uvInput = new FunctionInputNode();\r\n * uvInput.name = 'uv';\r\n * uvInput.type = 'vec2';\r\n *\r\n * const scaleInput = new FunctionInputNode();\r\n * scaleInput.name = 'scale';\r\n * scaleInput.type = 'float';\r\n *\r\n * // These will become inputs on any FunctionCallNode that uses this blueprint\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport class FunctionInputNode extends BaseGraphNode {\r\n /** Static counter for auto-generating unique argument names */\r\n static argId = 1;\r\n /** The data type of this parameter */\r\n private _type: string;\r\n /**\r\n * Creates a new function input node\r\n *\r\n * @remarks\r\n * Initializes with:\r\n * - Default type: vec4\r\n * - Auto-generated name: arg_N (where N is an incrementing counter)\r\n * - One output slot to provide the parameter value within the function\r\n */\r\n constructor() {\r\n super();\r\n this._type = 'vec4';\r\n this._outputs = [{ id: 1, name: `arg_${FunctionInputNode.argId++}` }];\r\n }\r\n /**\r\n * Gets the parameter type\r\n *\r\n * @returns The data type (float, vec2, vec3, vec4, mat2, mat3, or mat4)\r\n */\r\n get type() {\r\n return this._type;\r\n }\r\n /**\r\n * Gets the parameter name\r\n *\r\n * @returns The parameter name used in function calls\r\n */\r\n get name() {\r\n return this._outputs[0].name;\r\n }\r\n set name(val: string) {\r\n if (val) {\r\n this._outputs[0].name = val;\r\n }\r\n }\r\n /**\r\n * Gets the serialization descriptor for this node type\r\n *\r\n * @returns Serialization class descriptor\r\n *\r\n * @remarks\r\n * Serializes the parameter type and name. The type has an enumeration\r\n * constraint limited to valid shader types.\r\n */\r\n static getSerializationCls() {\r\n return {\r\n ctor: FunctionInputNode,\r\n name: 'FunctionInputNode',\r\n getProps() {\r\n return defineProps([\r\n {\r\n name: 'type',\r\n type: 'string',\r\n options: {\r\n enum: {\r\n labels: ['float', 'vec2', 'vec3', 'vec4', 'mat2', 'mat3', 'mat4'],\r\n values: ['float', 'vec2', 'vec3', 'vec4', 'mat2', 'mat3', 'mat4']\r\n }\r\n },\r\n get(this: FunctionInputNode, value) {\r\n value.str[0] = this._type;\r\n },\r\n set(this: FunctionInputNode, value) {\r\n this._type = value.str[0];\r\n }\r\n },\r\n {\r\n name: 'name',\r\n type: 'string',\r\n get(this: FunctionInputNode, value) {\r\n value.str[0] = this.name;\r\n },\r\n set(this: FunctionInputNode, value) {\r\n this.name = value.str[0];\r\n this.dispatchEvent('changed');\r\n }\r\n }\r\n ]);\r\n }\r\n };\r\n }\r\n /**\r\n * Generates a string representation of this node\r\n *\r\n * @returns 'FunctionInput'\r\n */\r\n toString() {\r\n return 'FunctionInput';\r\n }\r\n /**\r\n * Validates the node state\r\n *\r\n * @returns Empty string (always valid)\r\n *\r\n * @remarks\r\n * Function input nodes have no validation requirements as they\r\n * have no inputs and their type is explicitly set.\r\n */\r\n protected validate() {\r\n return '';\r\n }\r\n /**\r\n * Gets the output type\r\n *\r\n * @returns The parameter type\r\n */\r\n protected getType() {\r\n return this._type;\r\n }\r\n}\r\n\r\n/**\r\n * Function output value node\r\n *\r\n * @remarks\r\n * Represents an output value in a material function blueprint.\r\n * These nodes define what data the function returns to its caller.\r\n *\r\n * Each FunctionOutputNode:\r\n * - Has a name (output value name)\r\n * - Has one input that must be connected to compute the output value\r\n * - Automatically determines its type from the connected input\r\n * - Has no outputs (it provides its value to the calling context)\r\n *\r\n * When a FunctionCallNode is created, it scans for all FunctionOutputNodes\r\n * and creates corresponding output slots on the call node.\r\n *\r\n * A function can have multiple outputs to return different related values\r\n * (e.g., a noise function might return both noise value and derivative).\r\n *\r\n * @example\r\n * ```typescript\r\n * // In a function blueprint:\r\n * const resultOutput = new FunctionOutputNode();\r\n * resultOutput.name = 'result';\r\n * resultOutput.connectInput(1, computeNode, 1);\r\n *\r\n * const normalOutput = new FunctionOutputNode();\r\n * normalOutput.name = 'normal';\r\n * normalOutput.connectInput(1, normalNode, 1);\r\n *\r\n * // When called, the FunctionCallNode will have two outputs:\r\n * // - Output 1: result (type determined by computeNode)\r\n * // - Output 2: normal (type determined by normalNode)\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport class FunctionOutputNode extends BaseGraphNode {\r\n /** Static counter for auto-generating unique output names */\r\n static outId = 1;\r\n /**\r\n * Creates a new function output node\r\n *\r\n * @remarks\r\n * Initializes with:\r\n * - Auto-generated name: out_N (where N is an incrementing counter)\r\n * - One input slot that accepts any standard shader type\r\n * - Type is inferred from the connected input node\r\n */\r\n constructor() {\r\n super();\r\n this._inputs = [\r\n {\r\n id: 1,\r\n name: `out_${FunctionOutputNode.outId++}`,\r\n type: ['float', 'vec2', 'vec3', 'vec4', 'mat2', 'mat3', 'mat4']\r\n }\r\n ];\r\n }\r\n /**\r\n * Gets the output value name\r\n *\r\n * @returns The output name used in function calls\r\n */\r\n get name() {\r\n return this._inputs[0].name;\r\n }\r\n set name(val: string) {\r\n if (val) {\r\n this._inputs[0].name = val;\r\n }\r\n }\r\n /**\r\n * Gets the output value type\r\n *\r\n * @returns The data type inferred from the connected input\r\n *\r\n * @remarks\r\n * This is a convenience accessor that calls getType().\r\n */\r\n get type() {\r\n return this.getType();\r\n }\r\n /**\r\n * Gets the serialization descriptor for this node type\r\n *\r\n * @returns Serialization class descriptor\r\n *\r\n * @remarks\r\n * Only serializes the output name. The type is inferred at runtime\r\n * from the connected input node.\r\n */\r\n static getSerializationCls() {\r\n return {\r\n ctor: FunctionOutputNode,\r\n name: 'FunctionOutputNode',\r\n getProps() {\r\n return defineProps([\r\n {\r\n name: 'name',\r\n type: 'string',\r\n get(this: FunctionOutputNode, value) {\r\n value.str[0] = this.name;\r\n },\r\n set(this: FunctionOutputNode, value) {\r\n this.name = value.str[0];\r\n this.dispatchEvent('changed');\r\n }\r\n }\r\n ]);\r\n }\r\n };\r\n }\r\n /**\r\n * Generates a string representation of this node\r\n *\r\n * @returns 'FunctionOutput'\r\n */\r\n toString() {\r\n return 'FunctionOutput';\r\n }\r\n /**\r\n * Validates the node state\r\n *\r\n * @returns Error message if invalid, empty string if valid\r\n *\r\n * @remarks\r\n * Ensures:\r\n * - The input is connected (function must return a value)\r\n * - The input type can be determined\r\n */\r\n protected validate() {\r\n if (!this._inputs[0].inputNode) {\r\n return 'Missing result';\r\n }\r\n const type = this._inputs[0].inputNode.getOutputType(this._inputs[0].inputId!);\r\n if (!type) {\r\n return 'Cannot determin result type';\r\n }\r\n return '';\r\n }\r\n /**\r\n * Gets the output type based on the connected input\r\n *\r\n * @returns The type from the connected input node, or empty string if not connected\r\n *\r\n * @remarks\r\n * The output type is dynamically determined by tracing back through\r\n * the connected input to find its source type. This allows functions\r\n * to work with multiple types without explicit type declarations.\r\n */\r\n protected getType() {\r\n return this._inputs[0].inputNode ? this._inputs[0].inputNode.getOutputType(this._inputs[0].inputId!) : '';\r\n }\r\n}\r\n"],"names":["FunctionCallNode","BaseGraphNode","path","name","IR","_path","_name","_IR","_args","_outs","_inputs","_outputs","k","objectKeys","DAG","nodeMap","node","FunctionInputNode","push","index","Number","type","id","length","FunctionOutputNode","swizzle","args","outs","getSerializationCls","manager","ctor","createFunc","_","init","loadBluePrint","funcName","VFS","basename","extname","obj","getInitParams","getProps","toString","i","inputNode","getOutputType","inputId","includes","getType","argId","_type","val","defineProps","options","enum","labels","values","get","value","str","set","dispatchEvent","outId"],"mappings":";;;;AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsCO,MAAMA,gBAAyBC,SAAAA,aAAAA,CA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,CAACxD,IAAI;AAC1B,yBAAA;AACAyD,wBAAAA,GAAAA,CAAAA,CAA8BF,KAAK,EAAA;AACjC,4BAAA,IAAI,CAACvD,IAAI,GAAGuD,KAAMC,CAAAA,GAAG,CAAC,CAAE,CAAA;4BACxB,IAAI,CAACE,aAAa,CAAC,SAAA,CAAA;AACrB;AACF;AACD,iBAAA,CAAA;AACH;AACF,SAAA;AACF;AACA;;;;AAIC,MACDnB,QAAW,GAAA;QACT,OAAO,gBAAA;AACT;AACA;;;;;;;;;AASC,MACD,QAAqB,GAAA;QACnB,IAAI,CAAC,IAAI,CAAChC,OAAO,CAAC,CAAE,CAAA,CAACkC,SAAS,EAAE;YAC9B,OAAO,gBAAA;AACT;AACA,QAAA,MAAMvB,OAAO,IAAI,CAACX,OAAO,CAAC,EAAE,CAACkC,SAAS,CAACC,aAAa,CAAC,IAAI,CAACnC,OAAO,CAAC,CAAA,CAAE,CAACoC,OAAO,CAAA;AAC5E,QAAA,IAAI,CAACzB,IAAM,EAAA;YACT,OAAO,6BAAA;AACT;QACA,OAAO,EAAA;AACT;AACA;;;;;;;;;AASC,MACD,OAAoB,GAAA;QAClB,OAAO,IAAI,CAACX,OAAO,CAAC,CAAA,CAAE,CAACkC,SAAS,GAAG,IAAI,CAAClC,OAAO,CAAC,EAAE,CAACkC,SAAS,CAACC,aAAa,CAAC,IAAI,CAACnC,OAAO,CAAC,CAAA,CAAE,CAACoC,OAAO,CAAK,GAAA,EAAA;AACzG;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"func.js","sources":["../../../../src/utility/blueprint/material/func.ts"],"sourcesContent":["import { objectKeys } from '@zephyr3d/base';\r\nimport type { ResourceManager } from '../../serialization';\r\nimport { defineProps } from '../../serialization/types';\r\nimport { BaseGraphNode } from '../node';\r\nimport type { MaterialBlueprintIR } from './ir';\r\n\r\nconst materialFunctionValueTypes = ['float', 'vec2', 'vec3', 'vec4', 'mat2', 'mat3', 'mat4'] as const;\r\nconst materialFunctionInputTypes = [...materialFunctionValueTypes, 'tex2D'] as const;\r\n\r\ntype MaterialFunctionInterfaceEntry<T extends FunctionInputNode | FunctionOutputNode> = {\r\n index: number;\r\n slotId: number;\r\n node: T;\r\n};\r\n\r\nfunction compareMaterialFunctionInterfaceEntries(\r\n a: MaterialFunctionInterfaceEntry<FunctionInputNode | FunctionOutputNode>,\r\n b: MaterialFunctionInterfaceEntry<FunctionInputNode | FunctionOutputNode>\r\n) {\r\n const aHasOrder = a.node.order >= 0;\r\n const bHasOrder = b.node.order >= 0;\r\n if (aHasOrder !== bHasOrder) {\r\n return aHasOrder ? -1 : 1;\r\n }\r\n if (aHasOrder && a.node.order !== b.node.order) {\r\n return a.node.order - b.node.order;\r\n }\r\n const nameOrder = a.node.name.localeCompare(b.node.name, 'en', {\r\n numeric: true,\r\n sensitivity: 'base'\r\n });\r\n return nameOrder || a.index - b.index;\r\n}\r\n\r\n/**\r\n * Function call node for material blueprint functions\r\n *\r\n * @remarks\r\n * Represents a call to a reusable material function (sub-graph) within the material node graph.\r\n * Functions are defined in separate blueprint files and can be instantiated multiple times.\r\n *\r\n * The node automatically:\r\n * - Discovers function inputs (FunctionInputNode) and creates corresponding input slots\r\n * - Discovers function outputs (FunctionOutputNode) and creates corresponding output slots\r\n * - Validates input types match the function's parameter types\r\n *\r\n * Benefits of using material functions:\r\n * - Code reuse across multiple materials\r\n * - Encapsulation of complex logic\r\n * - Easier maintenance (update function once, affects all uses)\r\n * - Better organization of large material graphs\r\n *\r\n * @example\r\n * ```typescript\r\n * // Load and instantiate a custom noise function\r\n * const noiseIR = await manager.loadBluePrint('functions/noise.mtlfunc');\r\n * const noiseCall = new FunctionCallNode(\r\n * 'functions/noise.mtlfunc',\r\n * 'noise',\r\n * noiseIR\r\n * );\r\n *\r\n * // Connect inputs\r\n * noiseCall.connectInput(1, uvNode, 1); // UV coordinates\r\n * noiseCall.connectInput(2, scaleNode, 1); // Scale parameter\r\n *\r\n * // Use outputs\r\n * colorNode.connectInput(1, noiseCall, 1); // Noise result\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport class FunctionCallNode extends BaseGraphNode {\r\n /** The file path to the function blueprint */\r\n private _name: string;\r\n /** The file path to the function blueprint */\r\n private _path: string;\r\n /** The intermediate representation (compiled graph) of the function */\r\n private _IR: MaterialBlueprintIR;\r\n /** Function input parameters with their indices, names, and types */\r\n private _args: { index: number; slotId: number; name: string; type: string }[];\r\n /** Function output values with their indices, names, and types */\r\n private _outs: { index: number; slotId: number; name: string; type: string }[];\r\n /**\r\n * Creates a new function call node\r\n *\r\n * @param path - The file path to the function blueprint\r\n * @param name - The display name of the function\r\n * @param IR - The compiled intermediate representation of the function\r\n *\r\n * @remarks\r\n * The constructor scans the function's IR to:\r\n * 1. Find all FunctionInputNode instances and create input slots\r\n * 2. Find all FunctionOutputNode instances and create output slots\r\n * 3. Extract parameter names and types for validation\r\n *\r\n * Input/output slots use explicit interface order when present and otherwise\r\n * sort naturally by name. Slot IDs retain their legacy nodeMap order so saved\r\n * graph connections remain compatible.\r\n */\r\n constructor(path: string, name: string, IR: MaterialBlueprintIR) {\r\n super();\r\n this._path = path;\r\n this._name = name;\r\n this._IR = IR;\r\n this._args = [];\r\n this._outs = [];\r\n this._inputs = [];\r\n this._outputs = [];\r\n const inputs: MaterialFunctionInterfaceEntry<FunctionInputNode>[] = [];\r\n const outputs: MaterialFunctionInterfaceEntry<FunctionOutputNode>[] = [];\r\n for (const k of objectKeys(this._IR.DAG.nodeMap)) {\r\n const node = this._IR.DAG.nodeMap[k];\r\n if (node instanceof FunctionInputNode) {\r\n inputs.push({ index: Number(k), slotId: inputs.length + 1, node });\r\n } else if (node instanceof FunctionOutputNode) {\r\n outputs.push({ index: Number(k), slotId: outputs.length + 1, node });\r\n }\r\n }\r\n inputs.sort(compareMaterialFunctionInterfaceEntries);\r\n outputs.sort(compareMaterialFunctionInterfaceEntries);\r\n for (const input of inputs) {\r\n const name = input.node.name || `arg_${input.index}`;\r\n this._args.push({\r\n index: input.index,\r\n slotId: input.slotId,\r\n name,\r\n type: input.node.type\r\n });\r\n this._inputs.push({\r\n id: input.slotId,\r\n name,\r\n type: [input.node.type]\r\n });\r\n }\r\n for (const output of outputs) {\r\n const name = output.node.name || `out_${output.index}`;\r\n this._outs.push({\r\n index: output.index,\r\n slotId: output.slotId,\r\n name,\r\n type: output.node.type\r\n });\r\n this._outputs.push({\r\n id: output.slotId,\r\n name\r\n });\r\n }\r\n if (!(this._outs.length === 1 && this._outs[0].type === 'tex2D')) {\r\n this._outputs.forEach((output, index) => {\r\n output.swizzle = this._outs[index].name;\r\n });\r\n }\r\n }\r\n /**\r\n * Gets the file path to the function blueprint\r\n */\r\n get path() {\r\n return this._path;\r\n }\r\n /**\r\n * Gets the function name\r\n */\r\n get name() {\r\n return this._name;\r\n }\r\n /**\r\n * Gets the intermediate representation (IR) of the function\r\n *\r\n * @remarks\r\n * The IR contains the compiled node graph that will be inlined\r\n * or called during shader code generation.\r\n */\r\n get IR() {\r\n return this._IR;\r\n }\r\n /**\r\n * Gets the function's input parameter definitions\r\n *\r\n * @returns Array of parameter descriptors with index, name, and type\r\n */\r\n get args() {\r\n return this._args;\r\n }\r\n /**\r\n * Gets the function's output value definitions\r\n *\r\n * @returns Array of output descriptors with index, name, and type\r\n */\r\n get outs() {\r\n return this._outs;\r\n }\r\n /**\r\n * Gets the serialization descriptor for this node type\r\n *\r\n * @param manager - The serialization manager for loading blueprints\r\n * @returns Serialization class descriptor\r\n *\r\n * @remarks\r\n * Uses a custom createFunc to asynchronously load the function blueprint\r\n * from the file system. The initialization parameter is the blueprint path.\r\n */\r\n static getSerializationCls(manager: ResourceManager) {\r\n return {\r\n ctor: FunctionCallNode,\r\n name: 'FunctionCallNode',\r\n async createFunc(_: unknown, init: string) {\r\n const IR = await manager.loadBluePrint(init);\r\n const funcName = manager.VFS.basename(init, manager.VFS.extname(init));\r\n return { obj: new FunctionCallNode(init, funcName, IR!['func']) };\r\n },\r\n getInitParams(obj: FunctionCallNode) {\r\n return obj.path;\r\n },\r\n getProps() {\r\n return [];\r\n }\r\n };\r\n }\r\n /**\r\n * Generates a string representation of this node\r\n *\r\n * @returns The function name\r\n */\r\n toString() {\r\n return this._name;\r\n }\r\n /**\r\n * Validates the node state and input types\r\n *\r\n * @returns Error message if invalid, empty string if valid\r\n *\r\n * @remarks\r\n * Ensures:\r\n * - All required inputs are connected\r\n * - Input types can be determined\r\n * - Input types match the function's parameter types\r\n */\r\n protected validate() {\r\n for (let i = 0; i < this._inputs.length; i++) {\r\n const name = this._inputs[i].name;\r\n if (!this._inputs[i].inputNode) {\r\n return `Missing argument \\`${name}\\``;\r\n }\r\n const type = this._inputs[i].inputNode!.getOutputType(this._inputs[i].inputId!);\r\n if (!type) {\r\n return `Cannot determine type of argument \\`${name}\\``;\r\n }\r\n if (!this._inputs[i].type.includes(type)) {\r\n return `Invalid input type ${type}`;\r\n }\r\n }\r\n return '';\r\n }\r\n /**\r\n * Gets the output type for a specific output slot\r\n *\r\n * @param id - The output slot ID (1-based)\r\n * @returns The type of the output value\r\n *\r\n * @remarks\r\n * Returns the type declared by the corresponding FunctionOutputNode\r\n * in the function's blueprint.\r\n */\r\n protected getType(id: number) {\r\n return this._outs.find((output) => output.slotId === id)!.type;\r\n }\r\n}\r\n\r\n/**\r\n * Function input parameter node\r\n *\r\n * @remarks\r\n * Represents an input parameter in a material function blueprint.\r\n * These nodes define the function's interface - what data must be provided\r\n * when the function is called from another material graph.\r\n *\r\n * Each FunctionInputNode:\r\n * - Has a name (parameter name)\r\n * - Has a type (float, vec2, vec3, vec4, mat2, mat3, mat4, or tex2D)\r\n * - Has an optional explicit interface order (-1 sorts automatically by name)\r\n * - Produces one output that provides the parameter value within the function\r\n * - Has no inputs (it receives its value from the calling context)\r\n *\r\n * When a FunctionCallNode is created, it scans for all FunctionInputNodes\r\n * and creates corresponding input slots on the call node.\r\n *\r\n * @example\r\n * ```typescript\r\n * // In a function blueprint:\r\n * const uvInput = new FunctionInputNode();\r\n * uvInput.name = 'uv';\r\n * uvInput.type = 'vec2';\r\n *\r\n * const scaleInput = new FunctionInputNode();\r\n * scaleInput.name = 'scale';\r\n * scaleInput.type = 'float';\r\n *\r\n * // These will become inputs on any FunctionCallNode that uses this blueprint\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport class FunctionInputNode extends BaseGraphNode {\r\n /** Static counter for auto-generating unique argument names */\r\n static argId = 1;\r\n /** The data type of this parameter */\r\n private _type: string;\r\n /** Explicit interface order, or -1 to sort automatically by name */\r\n private _order: number;\r\n /**\r\n * Creates a new function input node\r\n *\r\n * @remarks\r\n * Initializes with:\r\n * - Default type: vec4\r\n * - Auto-generated name: arg_N (where N is an incrementing counter)\r\n * - One output slot to provide the parameter value within the function\r\n */\r\n constructor() {\r\n super();\r\n this._type = 'vec4';\r\n this._order = -1;\r\n this._outputs = [{ id: 1, name: `arg_${FunctionInputNode.argId++}` }];\r\n }\r\n /**\r\n * Gets the parameter type\r\n *\r\n * @returns The data type (float, vec2, vec3, vec4, mat2, mat3, mat4, or tex2D)\r\n */\r\n get type() {\r\n return this._type;\r\n }\r\n /**\r\n * Gets the parameter name\r\n *\r\n * @returns The parameter name used in function calls\r\n */\r\n get name() {\r\n return this._outputs[0].name;\r\n }\r\n set name(val: string) {\r\n if (val) {\r\n this._outputs[0].name = val;\r\n }\r\n }\r\n /** Gets the explicit interface order, or -1 when automatic name sorting is used. */\r\n get order() {\r\n return this._order;\r\n }\r\n set order(val: number) {\r\n const order = Number.isFinite(val) ? Math.max(-1, Math.trunc(val)) : -1;\r\n if (this._order !== order) {\r\n this._order = order;\r\n this.dispatchEvent('changed');\r\n }\r\n }\r\n /**\r\n * Gets the serialization descriptor for this node type\r\n *\r\n * @returns Serialization class descriptor\r\n *\r\n * @remarks\r\n * Serializes the parameter type, name, and interface order. The type has an enumeration\r\n * constraint limited to valid shader types.\r\n */\r\n static getSerializationCls() {\r\n return {\r\n ctor: FunctionInputNode,\r\n name: 'FunctionInputNode',\r\n getProps() {\r\n return defineProps([\r\n {\r\n name: 'type',\r\n type: 'string',\r\n options: {\r\n enum: {\r\n labels: [...materialFunctionInputTypes],\r\n values: [...materialFunctionInputTypes]\r\n }\r\n },\r\n get(this: FunctionInputNode, value) {\r\n value.str[0] = this._type;\r\n },\r\n set(this: FunctionInputNode, value) {\r\n this._type = value.str[0];\r\n }\r\n },\r\n {\r\n name: 'name',\r\n type: 'string',\r\n get(this: FunctionInputNode, value) {\r\n value.str[0] = this.name;\r\n },\r\n set(this: FunctionInputNode, value) {\r\n this.name = value.str[0];\r\n this.dispatchEvent('changed');\r\n }\r\n },\r\n {\r\n name: 'order',\r\n type: 'int',\r\n default: -1,\r\n description: 'Interface order. Use -1 to sort automatically by name.',\r\n options: {\r\n minValue: -1,\r\n speed: 1\r\n },\r\n get(this: FunctionInputNode, value) {\r\n value.num[0] = this._order;\r\n },\r\n set(this: FunctionInputNode, value) {\r\n this.order = value.num[0];\r\n }\r\n }\r\n ]);\r\n }\r\n };\r\n }\r\n /**\r\n * Generates a string representation of this node\r\n *\r\n * @returns 'FunctionInput'\r\n */\r\n toString() {\r\n return 'FunctionInput';\r\n }\r\n /**\r\n * Validates the node state\r\n *\r\n * @returns Empty string (always valid)\r\n *\r\n * @remarks\r\n * Function input nodes have no validation requirements as they\r\n * have no inputs and their type is explicitly set.\r\n */\r\n protected validate() {\r\n return '';\r\n }\r\n /**\r\n * Gets the output type\r\n *\r\n * @returns The parameter type\r\n */\r\n protected getType() {\r\n return this._type;\r\n }\r\n}\r\n\r\n/**\r\n * Function output value node\r\n *\r\n * @remarks\r\n * Represents an output value in a material function blueprint.\r\n * These nodes define what data the function returns to its caller.\r\n *\r\n * Each FunctionOutputNode:\r\n * - Has a name (output value name)\r\n * - Has an optional explicit interface order (-1 sorts automatically by name)\r\n * - Has one input that must be connected to compute the output value\r\n * - Automatically determines its type from the connected input\r\n * - Has no outputs (it provides its value to the calling context)\r\n *\r\n * When a FunctionCallNode is created, it scans for all FunctionOutputNodes\r\n * and creates corresponding output slots on the call node.\r\n *\r\n * A function can have multiple outputs to return different related values\r\n * (e.g., a noise function might return both noise value and derivative).\r\n *\r\n * @example\r\n * ```typescript\r\n * // In a function blueprint:\r\n * const resultOutput = new FunctionOutputNode();\r\n * resultOutput.name = 'result';\r\n * resultOutput.connectInput(1, computeNode, 1);\r\n *\r\n * const normalOutput = new FunctionOutputNode();\r\n * normalOutput.name = 'normal';\r\n * normalOutput.connectInput(1, normalNode, 1);\r\n *\r\n * // When called, the FunctionCallNode will have two outputs:\r\n * // - Output 1: result (type determined by computeNode)\r\n * // - Output 2: normal (type determined by normalNode)\r\n * ```\r\n *\r\n * @public\r\n */\r\nexport class FunctionOutputNode extends BaseGraphNode {\r\n /** Static counter for auto-generating unique output names */\r\n static outId = 1;\r\n /** Explicit interface order, or -1 to sort automatically by name */\r\n private _order: number;\r\n /**\r\n * Creates a new function output node\r\n *\r\n * @remarks\r\n * Initializes with:\r\n * - Auto-generated name: out_N (where N is an incrementing counter)\r\n * - One input slot that accepts numeric/matrix values and tex2D\r\n * - Type is inferred from the connected input node\r\n */\r\n constructor() {\r\n super();\r\n this._order = -1;\r\n this._inputs = [\r\n {\r\n id: 1,\r\n name: `out_${FunctionOutputNode.outId++}`,\r\n type: [...materialFunctionInputTypes]\r\n }\r\n ];\r\n }\r\n /**\r\n * Gets the output value name\r\n *\r\n * @returns The output name used in function calls\r\n */\r\n get name() {\r\n return this._inputs[0].name;\r\n }\r\n set name(val: string) {\r\n if (val) {\r\n this._inputs[0].name = val;\r\n }\r\n }\r\n /** Gets the explicit interface order, or -1 when automatic name sorting is used. */\r\n get order() {\r\n return this._order;\r\n }\r\n set order(val: number) {\r\n const order = Number.isFinite(val) ? Math.max(-1, Math.trunc(val)) : -1;\r\n if (this._order !== order) {\r\n this._order = order;\r\n this.dispatchEvent('changed');\r\n }\r\n }\r\n /**\r\n * Gets the output value type\r\n *\r\n * @returns The data type inferred from the connected input\r\n *\r\n * @remarks\r\n * This is a convenience accessor that calls getType().\r\n */\r\n get type() {\r\n return this.getType();\r\n }\r\n /**\r\n * Gets the serialization descriptor for this node type\r\n *\r\n * @returns Serialization class descriptor\r\n *\r\n * @remarks\r\n * Serializes the output name and interface order. The type is inferred at runtime\r\n * from the connected input node.\r\n */\r\n static getSerializationCls() {\r\n return {\r\n ctor: FunctionOutputNode,\r\n name: 'FunctionOutputNode',\r\n getProps() {\r\n return defineProps([\r\n {\r\n name: 'name',\r\n type: 'string',\r\n get(this: FunctionOutputNode, value) {\r\n value.str[0] = this.name;\r\n },\r\n set(this: FunctionOutputNode, value) {\r\n this.name = value.str[0];\r\n this.dispatchEvent('changed');\r\n }\r\n },\r\n {\r\n name: 'order',\r\n type: 'int',\r\n default: -1,\r\n description: 'Interface order. Use -1 to sort automatically by name.',\r\n options: {\r\n minValue: -1,\r\n speed: 1\r\n },\r\n get(this: FunctionOutputNode, value) {\r\n value.num[0] = this._order;\r\n },\r\n set(this: FunctionOutputNode, value) {\r\n this.order = value.num[0];\r\n }\r\n }\r\n ]);\r\n }\r\n };\r\n }\r\n /**\r\n * Generates a string representation of this node\r\n *\r\n * @returns 'FunctionOutput'\r\n */\r\n toString() {\r\n return 'FunctionOutput';\r\n }\r\n /**\r\n * Validates the node state\r\n *\r\n * @returns Error message if invalid, empty string if valid\r\n *\r\n * @remarks\r\n * Ensures:\r\n * - The input is connected (function must return a value)\r\n * - The input type can be determined\r\n */\r\n protected validate() {\r\n if (!this._inputs[0].inputNode) {\r\n return 'Missing result';\r\n }\r\n const type = this._inputs[0].inputNode.getOutputType(this._inputs[0].inputId!);\r\n if (!type) {\r\n return 'Cannot determin result type';\r\n }\r\n return '';\r\n }\r\n /**\r\n * Gets the output type based on the connected input\r\n *\r\n * @returns The type from the connected input node, or empty string if not connected\r\n *\r\n * @remarks\r\n * The output type is dynamically determined by tracing back through\r\n * the connected input to find its source type. This allows functions\r\n * to work with multiple types without explicit type declarations.\r\n */\r\n protected getType() {\r\n return this._inputs[0].inputNode ? this._inputs[0].inputNode.getOutputType(this._inputs[0].inputId!) : '';\r\n }\r\n}\r\n"],"names":["materialFunctionValueTypes","materialFunctionInputTypes","compareMaterialFunctionInterfaceEntries","a","b","aHasOrder","node","order","bHasOrder","nameOrder","name","localeCompare","numeric","sensitivity","index","FunctionCallNode","BaseGraphNode","path","IR","_path","_name","_IR","_args","_outs","_inputs","_outputs","inputs","outputs","k","objectKeys","DAG","nodeMap","FunctionInputNode","push","Number","slotId","length","FunctionOutputNode","sort","input","type","id","output","forEach","swizzle","args","outs","getSerializationCls","manager","ctor","createFunc","_","init","loadBluePrint","funcName","VFS","basename","extname","obj","getInitParams","getProps","toString","i","inputNode","getOutputType","inputId","includes","getType","find","argId","_type","_order","val","isFinite","Math","max","trunc","dispatchEvent","defineProps","options","enum","labels","values","get","value","str","set","default","description","minValue","speed","num","outId"],"mappings":";;;;AAMA,MAAMA,0BAA6B,GAAA;AAAC,IAAA,OAAA;AAAS,IAAA,MAAA;AAAQ,IAAA,MAAA;AAAQ,IAAA,MAAA;AAAQ,IAAA,MAAA;AAAQ,IAAA,MAAA;AAAQ,IAAA;AAAO,CAAA;AAC5F,MAAMC,0BAA6B,GAAA;AAAID,IAAAA,GAAAA,0BAAAA;AAA4B,IAAA;AAAQ,CAAA;AAQ3E,SAASE,uCAAAA,CACPC,CAAyE,EACzEC,CAAyE,EAAA;AAEzE,IAAA,MAAMC,SAAYF,GAAAA,CAAAA,CAAEG,IAAI,CAACC,KAAK,IAAI,CAAA;AAClC,IAAA,MAAMC,SAAYJ,GAAAA,CAAAA,CAAEE,IAAI,CAACC,KAAK,IAAI,CAAA;AAClC,IAAA,IAAIF,cAAcG,SAAW,EAAA;QAC3B,OAAOH,SAAAA,GAAY,EAAK,GAAA,CAAA;AAC1B;IACA,IAAIA,SAAAA,IAAaF,CAAEG,CAAAA,IAAI,CAACC,KAAK,KAAKH,CAAEE,CAAAA,IAAI,CAACC,KAAK,EAAE;QAC9C,OAAOJ,CAAAA,CAAEG,IAAI,CAACC,KAAK,GAAGH,CAA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