@holoscript/core 6.0.4 → 7.0.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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/compiler/index.d.ts +82 -0
- package/dist/constants.d.ts +3 -2
- package/dist/coordinators/index.d.ts +189 -0
- package/dist/index.d.ts +501 -19
- package/dist/paper-0c-spike/index.d.ts +29 -0
- package/dist/reconstruction/index.d.ts +78 -0
- package/dist/tools/index.d.ts +22 -1
- package/dist/traitDocs/traitDocs.d.ts +69 -0
- package/dist/traits/index.d.ts +61 -0
- package/package.json +105 -57
- package/dist/GLTFPipeline-DEN36VNK.js +0 -12
- package/dist/GLTFPipeline-YPCAK236.cjs +0 -33
- package/dist/HoloScriptPlusParser-BN6KVRCM.js +0 -692
- package/dist/HoloScriptPlusParser-NC5FE6AL.cjs +0 -697
- package/dist/USDZExporter-NTMBNTDB.js +0 -707
- package/dist/USDZExporter-UWGWNMMD.cjs +0 -709
- package/dist/chunk-27LWW5FU.cjs +0 -410
- package/dist/chunk-2CWOLHTE.js +0 -69
- package/dist/chunk-33LSUQDD.cjs +0 -835
- package/dist/chunk-3FJCK5XA.js +0 -2232
- package/dist/chunk-3FXV5S25.cjs +0 -633
- package/dist/chunk-3FYZOR7S.cjs +0 -69
- package/dist/chunk-3SAK5KFL.cjs +0 -83
- package/dist/chunk-4XSNJCLC.cjs +0 -1859
- package/dist/chunk-54FHG2MX.js +0 -655
- package/dist/chunk-56IF4NTA.js +0 -56
- package/dist/chunk-5BGSECRJ.cjs +0 -2237
- package/dist/chunk-5GLCTO44.js +0 -161
- package/dist/chunk-5O6TQC6M.cjs +0 -1871
- package/dist/chunk-5OEOHAAW.cjs +0 -682
- package/dist/chunk-5TOFIR6L.js +0 -407
- package/dist/chunk-5WUNN6ZN.cjs +0 -428
- package/dist/chunk-6TZPZCOJ.cjs +0 -1404
- package/dist/chunk-6UEHYZ7V.cjs +0 -773
- package/dist/chunk-6XSERL6L.js +0 -5678
- package/dist/chunk-72EQECGT.cjs +0 -908
- package/dist/chunk-7AGYRWKW.cjs +0 -507
- package/dist/chunk-7LCYLPW2.cjs +0 -663
- package/dist/chunk-A7PIMZGU.js +0 -263
- package/dist/chunk-ATSKSYVE.cjs +0 -51683
- package/dist/chunk-B5TCIAPQ.cjs +0 -117
- package/dist/chunk-BF2235SI.cjs +0 -5714
- package/dist/chunk-BKIGPPVM.js +0 -629
- package/dist/chunk-BND3ST2K.cjs +0 -662
- package/dist/chunk-BU7VWW2K.js +0 -2522
- package/dist/chunk-BWFJEM5A.js +0 -5419
- package/dist/chunk-CAUCGUEA.cjs +0 -130
- package/dist/chunk-CBJSLA2E.cjs +0 -5423
- package/dist/chunk-CDPGV4DN.js +0 -114
- package/dist/chunk-CLYEIWA5.cjs +0 -408
- package/dist/chunk-CS2EMTGF.js +0 -1966
- package/dist/chunk-DMG7C4H2.js +0 -975
- package/dist/chunk-DXJQDCFL.js +0 -468
- package/dist/chunk-E3FWRT3Z.js +0 -608
- package/dist/chunk-E3UALNFA.js +0 -421
- package/dist/chunk-EONILVMF.js +0 -762
- package/dist/chunk-EQV4R3EV.cjs +0 -769
- package/dist/chunk-F3HH56EB.cjs +0 -5538
- package/dist/chunk-F4IULT7N.js +0 -1488
- package/dist/chunk-FF3Q7ADR.js +0 -380
- package/dist/chunk-FFKU7BTK.cjs +0 -1046
- package/dist/chunk-FHQVYCH2.js +0 -70
- package/dist/chunk-FSF7EQVA.cjs +0 -1974
- package/dist/chunk-G4VZTCIB.js +0 -659
- package/dist/chunk-G7CT3EMP.cjs +0 -1002
- package/dist/chunk-GGHSW2NN.js +0 -51334
- package/dist/chunk-GVUR45UF.cjs +0 -777
- package/dist/chunk-H5Z7NASB.js +0 -9662
- package/dist/chunk-HE7ULERA.cjs +0 -697
- package/dist/chunk-HJJLD366.js +0 -1169
- package/dist/chunk-HPS76H7Q.js +0 -309
- package/dist/chunk-HQUEA5R6.cjs +0 -424
- package/dist/chunk-HYNTS5CP.js +0 -422
- package/dist/chunk-I6XZ5DZF.cjs +0 -488
- package/dist/chunk-IBDG74G2.cjs +0 -1219
- package/dist/chunk-IFNQFCTM.js +0 -3098
- package/dist/chunk-IHOUYQIA.js +0 -406
- package/dist/chunk-ILRBGFVD.cjs +0 -72
- package/dist/chunk-IWI6J7FX.js +0 -421
- package/dist/chunk-K3JDKWGI.cjs +0 -270
- package/dist/chunk-K6EKD26I.js +0 -630
- package/dist/chunk-KCQ5NDYC.cjs +0 -3172
- package/dist/chunk-KED34ILP.js +0 -832
- package/dist/chunk-KSGXLT74.cjs +0 -457
- package/dist/chunk-L4G4RLXX.js +0 -767
- package/dist/chunk-LDP5OK6G.js +0 -1216
- package/dist/chunk-LGGRPKTV.cjs +0 -735
- package/dist/chunk-LK5IAVH6.cjs +0 -1173
- package/dist/chunk-LSW7P7ML.js +0 -3675
- package/dist/chunk-LXJ4667L.cjs +0 -3874
- package/dist/chunk-LZ266PCM.cjs +0 -4499
- package/dist/chunk-MD6KDHVE.cjs +0 -237
- package/dist/chunk-MEASWI2Y.js +0 -126
- package/dist/chunk-MPXBVFHQ.js +0 -768
- package/dist/chunk-N5FTS757.cjs +0 -415
- package/dist/chunk-NCUKG4SK.cjs +0 -3075
- package/dist/chunk-NDQNIJEH.js +0 -1715
- package/dist/chunk-NOZZ46QU.js +0 -168
- package/dist/chunk-OFKWH2IP.js +0 -449
- package/dist/chunk-PHENW4MQ.js +0 -65
- package/dist/chunk-PMGODDJA.cjs +0 -319
- package/dist/chunk-Q4QX3AET.cjs +0 -1505
- package/dist/chunk-Q56TT7IL.js +0 -483
- package/dist/chunk-Q5JT3YML.cjs +0 -129
- package/dist/chunk-Q5SJOGHQ.cjs +0 -4256
- package/dist/chunk-QGKNANZ3.js +0 -3071
- package/dist/chunk-QLEAOI3Q.cjs +0 -424
- package/dist/chunk-R7MA7QWV.js +0 -732
- package/dist/chunk-RVYPEYPX.js +0 -678
- package/dist/chunk-S2N5TNMA.js +0 -1855
- package/dist/chunk-S565K7NK.js +0 -752
- package/dist/chunk-SDAMZIRE.js +0 -765
- package/dist/chunk-T36DDXSF.js +0 -4250
- package/dist/chunk-T4NKMBDL.js +0 -5474
- package/dist/chunk-T7LEXZUZ.cjs +0 -2526
- package/dist/chunk-TEWCN33Y.js +0 -694
- package/dist/chunk-TQSZUOW5.cjs +0 -793
- package/dist/chunk-TSH3MSQU.cjs +0 -129
- package/dist/chunk-UERJ3YJV.js +0 -504
- package/dist/chunk-UPJBDCVF.js +0 -1395
- package/dist/chunk-V3NN3HPP.js +0 -4462
- package/dist/chunk-VJ3L7CHT.cjs +0 -169
- package/dist/chunk-WB4Z63GG.js +0 -229
- package/dist/chunk-WDW67DZB.cjs +0 -9728
- package/dist/chunk-WGMEAYBG.js +0 -126
- package/dist/chunk-X4ZF6CNE.cjs +0 -473
- package/dist/chunk-X6SEAXAX.cjs +0 -3681
- package/dist/chunk-XCWFGZAA.js +0 -1043
- package/dist/chunk-XD6IYDUX.js +0 -903
- package/dist/chunk-XG23EUQX.cjs +0 -1717
- package/dist/chunk-XRKWN5PL.cjs +0 -173
- package/dist/chunk-XUILI4KB.cjs +0 -430
- package/dist/chunk-XUTX5CBW.js +0 -126
- package/dist/chunk-XWPNTWDN.cjs +0 -755
- package/dist/chunk-XXINBTZK.cjs +0 -633
- package/dist/chunk-YCXFCXDS.js +0 -1868
- package/dist/chunk-YQK5JNFK.js +0 -3725
- package/dist/chunk-YYXH45E2.js +0 -426
- package/dist/chunk-Z34RLXRA.cjs +0 -612
- package/dist/chunk-ZP4D3CSX.cjs +0 -72
- package/dist/cli/holoscript-runner.cjs +0 -2259
- package/dist/cli/holoscript-runner.js +0 -2234
- package/dist/codebase/index.cjs +0 -336
- package/dist/codebase/index.js +0 -331
- package/dist/compiler/agent-inference.cjs +0 -28
- package/dist/compiler/agent-inference.js +0 -5
- package/dist/compiler/android-xr.cjs +0 -19
- package/dist/compiler/android-xr.js +0 -9
- package/dist/compiler/android.cjs +0 -20
- package/dist/compiler/android.js +0 -10
- package/dist/compiler/ar.cjs +0 -20
- package/dist/compiler/ar.js +0 -8
- package/dist/compiler/babylon.cjs +0 -17
- package/dist/compiler/babylon.js +0 -11
- package/dist/compiler/coco.cjs +0 -27
- package/dist/compiler/coco.js +0 -4
- package/dist/compiler/domain-block-utils.cjs +0 -602
- package/dist/compiler/domain-block-utils.js +0 -8
- package/dist/compiler/dtdl.cjs +0 -24
- package/dist/compiler/dtdl.js +0 -8
- package/dist/compiler/gltf-pipeline.cjs +0 -39
- package/dist/compiler/gltf-pipeline.js +0 -4
- package/dist/compiler/godot.cjs +0 -15
- package/dist/compiler/godot.js +0 -9
- package/dist/compiler/incremental.cjs +0 -29
- package/dist/compiler/incremental.js +0 -4
- package/dist/compiler/index.cjs +0 -2578
- package/dist/compiler/index.js +0 -2383
- package/dist/compiler/ios.cjs +0 -20
- package/dist/compiler/ios.js +0 -10
- package/dist/compiler/multi-layer.cjs +0 -20
- package/dist/compiler/multi-layer.js +0 -11
- package/dist/compiler/nodetoy.cjs +0 -23
- package/dist/compiler/nodetoy.js +0 -4
- package/dist/compiler/openxr.cjs +0 -15
- package/dist/compiler/openxr.js +0 -9
- package/dist/compiler/playcanvas.cjs +0 -16
- package/dist/compiler/playcanvas.js +0 -10
- package/dist/compiler/r3f.cjs +0 -34
- package/dist/compiler/r3f.js +0 -12
- package/dist/compiler/remotion.cjs +0 -23
- package/dist/compiler/remotion.js +0 -4
- package/dist/compiler/reproducibility.cjs +0 -39
- package/dist/compiler/reproducibility.js +0 -4
- package/dist/compiler/sdf.cjs +0 -21
- package/dist/compiler/sdf.js +0 -9
- package/dist/compiler/semantic-scene.cjs +0 -31
- package/dist/compiler/semantic-scene.js +0 -4
- package/dist/compiler/state.cjs +0 -17
- package/dist/compiler/state.js +0 -7
- package/dist/compiler/trait-composition.cjs +0 -26
- package/dist/compiler/trait-composition.js +0 -5
- package/dist/compiler/unity.cjs +0 -15
- package/dist/compiler/unity.js +0 -9
- package/dist/compiler/unreal.cjs +0 -19
- package/dist/compiler/unreal.js +0 -9
- package/dist/compiler/urdf.cjs +0 -45
- package/dist/compiler/urdf.js +0 -9
- package/dist/compiler/usd-physics.cjs +0 -23
- package/dist/compiler/usd-physics.js +0 -6
- package/dist/compiler/visionos.cjs +0 -15
- package/dist/compiler/visionos.js +0 -9
- package/dist/compiler/vrchat.cjs +0 -19
- package/dist/compiler/vrchat.js +0 -9
- package/dist/compiler/vrr.cjs +0 -21
- package/dist/compiler/vrr.js +0 -9
- package/dist/compiler/wasm.cjs +0 -33
- package/dist/compiler/wasm.js +0 -9
- package/dist/compiler/webgpu.cjs +0 -15
- package/dist/compiler/webgpu.js +0 -9
- package/dist/debugger.cjs +0 -21
- package/dist/debugger.js +0 -8
- package/dist/entries/interop.cjs +0 -62
- package/dist/entries/interop.js +0 -5
- package/dist/entries/scripting.cjs +0 -68
- package/dist/entries/scripting.js +0 -11
- package/dist/index.cjs +0 -40921
- package/dist/index.js +0 -37763
- package/dist/math/vec3.cjs +0 -57
- package/dist/math/vec3.js +0 -4
- package/dist/ml-dsa-PHCWUBPX.cjs +0 -1178
- package/dist/ml-dsa-WYLJHJO6.js +0 -1178
- package/dist/parser.cjs +0 -27
- package/dist/parser.js +0 -10
- package/dist/playwright-5OSAPTNH.js +0 -98660
- package/dist/playwright-RL6GY4F7.cjs +0 -98673
- package/dist/runtime.cjs +0 -16
- package/dist/runtime.js +0 -7
- package/dist/storage/index.cjs +0 -37
- package/dist/storage/index.js +0 -4
- package/dist/traits/index.cjs +0 -14649
- package/dist/traits/index.js +0 -12243
- package/dist/type-checker.cjs +0 -18
- package/dist/type-checker.js +0 -5
package/dist/chunk-27LWW5FU.cjs
DELETED
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/compiler/NodeToyMapping.ts
|
|
4
|
-
var NODE_TYPE_MAP = {
|
|
5
|
-
// Math operations
|
|
6
|
-
Add: { expression: "({in:a} + {in:b})", outputType: "float" },
|
|
7
|
-
Subtract: { expression: "({in:a} - {in:b})", outputType: "float" },
|
|
8
|
-
Multiply: { expression: "({in:a} * {in:b})", outputType: "float" },
|
|
9
|
-
Divide: { expression: "({in:a} / max({in:b}, 0.0001))", outputType: "float" },
|
|
10
|
-
Power: { expression: "pow({in:a}, {in:b})", outputType: "float" },
|
|
11
|
-
Sqrt: { expression: "sqrt({in:a})", outputType: "float" },
|
|
12
|
-
Abs: { expression: "abs({in:a})", outputType: "float" },
|
|
13
|
-
Sign: { expression: "sign({in:a})", outputType: "float" },
|
|
14
|
-
Floor: { expression: "floor({in:a})", outputType: "float" },
|
|
15
|
-
Ceil: { expression: "ceil({in:a})", outputType: "float" },
|
|
16
|
-
Fract: { expression: "fract({in:a})", outputType: "float" },
|
|
17
|
-
Mod: { expression: "mod({in:a}, {in:b})", outputType: "float" },
|
|
18
|
-
Min: { expression: "min({in:a}, {in:b})", outputType: "float" },
|
|
19
|
-
Max: { expression: "max({in:a}, {in:b})", outputType: "float" },
|
|
20
|
-
Clamp: { expression: "clamp({in:a}, {in:min}, {in:max})", outputType: "float" },
|
|
21
|
-
Lerp: { expression: "mix({in:a}, {in:b}, {in:t})", outputType: "float" },
|
|
22
|
-
Smoothstep: { expression: "smoothstep({in:edge0}, {in:edge1}, {in:x})", outputType: "float" },
|
|
23
|
-
Step: { expression: "step({in:edge}, {in:x})", outputType: "float" },
|
|
24
|
-
OneMinus: { expression: "(1.0 - {in:a})", outputType: "float" },
|
|
25
|
-
Negate: { expression: "(-{in:a})", outputType: "float" },
|
|
26
|
-
Length: { expression: "length({in:a})", outputType: "float" },
|
|
27
|
-
Distance: { expression: "distance({in:a}, {in:b})", outputType: "float" },
|
|
28
|
-
Dot: { expression: "dot({in:a}, {in:b})", outputType: "float" },
|
|
29
|
-
Cross: { expression: "cross({in:a}, {in:b})", outputType: "vec3" },
|
|
30
|
-
Normalize: { expression: "normalize({in:a})", outputType: "vec3" },
|
|
31
|
-
Reflect: { expression: "reflect({in:a}, {in:b})", outputType: "vec3" },
|
|
32
|
-
// Trigonometry
|
|
33
|
-
Sin: { expression: "sin({in:a})", outputType: "float" },
|
|
34
|
-
Cos: { expression: "cos({in:a})", outputType: "float" },
|
|
35
|
-
Tan: { expression: "tan({in:a})", outputType: "float" },
|
|
36
|
-
Asin: { expression: "asin({in:a})", outputType: "float" },
|
|
37
|
-
Acos: { expression: "acos({in:a})", outputType: "float" },
|
|
38
|
-
Atan: { expression: "atan({in:a})", outputType: "float" },
|
|
39
|
-
Atan2: { expression: "atan({in:y}, {in:x})", outputType: "float" },
|
|
40
|
-
// Color operations
|
|
41
|
-
Mix: { expression: "mix({in:a}, {in:b}, {in:factor})", outputType: "vec3" },
|
|
42
|
-
Saturate: { expression: "clamp({in:a}, 0.0, 1.0)", outputType: "float" },
|
|
43
|
-
// Constructors
|
|
44
|
-
Vec2: { expression: "vec2({in:x}, {in:y})", outputType: "vec2" },
|
|
45
|
-
Vec3: { expression: "vec3({in:x}, {in:y}, {in:z})", outputType: "vec3" },
|
|
46
|
-
Vec4: { expression: "vec4({in:x}, {in:y}, {in:z}, {in:w})", outputType: "vec4" },
|
|
47
|
-
// Component extraction
|
|
48
|
-
SplitVec2: { expression: "{in:a}", outputType: "float" },
|
|
49
|
-
SplitVec3: { expression: "{in:a}", outputType: "float" },
|
|
50
|
-
SplitVec4: { expression: "{in:a}", outputType: "float" },
|
|
51
|
-
// Texture sampling
|
|
52
|
-
Texture2D: { expression: "texture2D({in:sampler}, {in:uv})", outputType: "vec4" },
|
|
53
|
-
CubeMap: { expression: "textureCube({in:sampler}, {in:dir})", outputType: "vec4" },
|
|
54
|
-
// Noise
|
|
55
|
-
ProceduralNoise: { expression: "snoise({in:uv} * {in:scale})", outputType: "float" }
|
|
56
|
-
};
|
|
57
|
-
var BUILTIN_INPUT_NODES = /* @__PURE__ */ new Set([
|
|
58
|
-
"Time",
|
|
59
|
-
"Resolution",
|
|
60
|
-
"ScreenUV",
|
|
61
|
-
"UV",
|
|
62
|
-
"Normal",
|
|
63
|
-
"Position",
|
|
64
|
-
"ViewDirection",
|
|
65
|
-
"FragCoord",
|
|
66
|
-
"Constant",
|
|
67
|
-
"Parameter"
|
|
68
|
-
]);
|
|
69
|
-
var OUTPUT_NODES = /* @__PURE__ */ new Set(["FragColor", "Output", "Emission", "Alpha", "Discard"]);
|
|
70
|
-
function mapNodeToyToShader(graph, options = {}) {
|
|
71
|
-
const mapper = new NodeToyMapper(options);
|
|
72
|
-
return mapper.map(graph);
|
|
73
|
-
}
|
|
74
|
-
var NodeToyMapper = class {
|
|
75
|
-
constructor(options = {}) {
|
|
76
|
-
this.warnings = [];
|
|
77
|
-
this.unsupportedNodes = [];
|
|
78
|
-
this.uniforms = {};
|
|
79
|
-
this.varyingDecls = [];
|
|
80
|
-
this.fragmentLines = [];
|
|
81
|
-
this.nodeOutputVars = /* @__PURE__ */ new Map();
|
|
82
|
-
this.nodeMap = /* @__PURE__ */ new Map();
|
|
83
|
-
this.edgesByTarget = /* @__PURE__ */ new Map();
|
|
84
|
-
this.visitedNodes = /* @__PURE__ */ new Set();
|
|
85
|
-
this.language = options.language ?? "glsl";
|
|
86
|
-
this.autoTimeUniform = options.autoTimeUniform ?? true;
|
|
87
|
-
this.autoResolutionUniform = options.autoResolutionUniform ?? true;
|
|
88
|
-
this.variablePrefix = options.variablePrefix ?? "nt_";
|
|
89
|
-
this.optimization = options.optimization ?? "basic";
|
|
90
|
-
}
|
|
91
|
-
map(graph) {
|
|
92
|
-
this.warnings = [];
|
|
93
|
-
this.unsupportedNodes = [];
|
|
94
|
-
this.uniforms = {};
|
|
95
|
-
this.varyingDecls = [];
|
|
96
|
-
this.fragmentLines = [];
|
|
97
|
-
this.nodeOutputVars.clear();
|
|
98
|
-
this.nodeMap.clear();
|
|
99
|
-
this.edgesByTarget.clear();
|
|
100
|
-
this.visitedNodes.clear();
|
|
101
|
-
for (const node of graph.nodes) {
|
|
102
|
-
this.nodeMap.set(node.id, node);
|
|
103
|
-
}
|
|
104
|
-
for (const edge of graph.edges) {
|
|
105
|
-
const key = `${edge.toNode}:${edge.toPort}`;
|
|
106
|
-
if (!this.edgesByTarget.has(key)) {
|
|
107
|
-
this.edgesByTarget.set(key, []);
|
|
108
|
-
}
|
|
109
|
-
this.edgesByTarget.get(key).push(edge);
|
|
110
|
-
}
|
|
111
|
-
const outputNodes = graph.nodes.filter((n) => OUTPUT_NODES.has(n.type));
|
|
112
|
-
if (outputNodes.length === 0) {
|
|
113
|
-
this.warnings.push("No output node found in graph; generating passthrough shader");
|
|
114
|
-
}
|
|
115
|
-
for (const outputNode of outputNodes) {
|
|
116
|
-
this.traverseNode(outputNode.id);
|
|
117
|
-
}
|
|
118
|
-
const hasTimeNode = graph.nodes.some((n) => n.type === "Time");
|
|
119
|
-
const hasResolutionNode = graph.nodes.some((n) => n.type === "Resolution");
|
|
120
|
-
if (this.autoTimeUniform && hasTimeNode) {
|
|
121
|
-
this.uniforms["time"] = { type: "float", value: 0 };
|
|
122
|
-
}
|
|
123
|
-
if (this.autoResolutionUniform && hasResolutionNode) {
|
|
124
|
-
this.uniforms["resolution"] = { type: "vec2", value: [1920, 1080] };
|
|
125
|
-
}
|
|
126
|
-
for (const node of graph.nodes) {
|
|
127
|
-
if (node.type === "Parameter" || node.type === "Constant") {
|
|
128
|
-
this.extractParameterUniform(node);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
const vertexSource = this.generateVertexSource();
|
|
132
|
-
const fragmentSource = this.generateFragmentSource(outputNodes);
|
|
133
|
-
const shaderConfig = {
|
|
134
|
-
name: graph.name || "nodetoy_shader",
|
|
135
|
-
source: {
|
|
136
|
-
language: this.language,
|
|
137
|
-
vertex: vertexSource,
|
|
138
|
-
fragment: fragmentSource
|
|
139
|
-
},
|
|
140
|
-
uniforms: this.uniforms,
|
|
141
|
-
blendMode: graph.settings?.blendMode ?? "opaque",
|
|
142
|
-
depthTest: graph.settings?.depthTest ?? true,
|
|
143
|
-
depthWrite: graph.settings?.depthWrite ?? true,
|
|
144
|
-
cullFace: graph.settings?.doubleSided ? "none" : "back"
|
|
145
|
-
};
|
|
146
|
-
return {
|
|
147
|
-
shaderConfig,
|
|
148
|
-
vertexSource,
|
|
149
|
-
fragmentSource,
|
|
150
|
-
uniforms: this.uniforms,
|
|
151
|
-
warnings: this.warnings,
|
|
152
|
-
unsupportedNodes: this.unsupportedNodes
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
// ---------------------------------------------------------------------------
|
|
156
|
-
// Graph traversal (reverse topological from output nodes)
|
|
157
|
-
// ---------------------------------------------------------------------------
|
|
158
|
-
traverseNode(nodeId) {
|
|
159
|
-
if (this.nodeOutputVars.has(nodeId)) {
|
|
160
|
-
return this.nodeOutputVars.get(nodeId);
|
|
161
|
-
}
|
|
162
|
-
if (this.visitedNodes.has(nodeId)) {
|
|
163
|
-
this.warnings.push(`Cycle detected at node ${nodeId}; breaking with default value`);
|
|
164
|
-
return "0.0";
|
|
165
|
-
}
|
|
166
|
-
this.visitedNodes.add(nodeId);
|
|
167
|
-
const node = this.nodeMap.get(nodeId);
|
|
168
|
-
if (!node) {
|
|
169
|
-
this.warnings.push(`Missing node: ${nodeId}`);
|
|
170
|
-
return "0.0";
|
|
171
|
-
}
|
|
172
|
-
if (BUILTIN_INPUT_NODES.has(node.type)) {
|
|
173
|
-
const varExpr = this.resolveBuiltinNode(node);
|
|
174
|
-
this.nodeOutputVars.set(nodeId, varExpr);
|
|
175
|
-
return varExpr;
|
|
176
|
-
}
|
|
177
|
-
if (OUTPUT_NODES.has(node.type)) {
|
|
178
|
-
for (const input of node.inputs) {
|
|
179
|
-
const inputExpr = this.resolveInputPort(nodeId, input.name, input);
|
|
180
|
-
if (node.type === "FragColor" || node.type === "Output") {
|
|
181
|
-
this.fragmentLines.push(` // Output: ${node.label || node.type}`);
|
|
182
|
-
if (input.type === "vec4") {
|
|
183
|
-
this.fragmentLines.push(` gl_FragColor = ${inputExpr};`);
|
|
184
|
-
} else if (input.type === "vec3") {
|
|
185
|
-
this.fragmentLines.push(` gl_FragColor = vec4(${inputExpr}, 1.0);`);
|
|
186
|
-
} else {
|
|
187
|
-
this.fragmentLines.push(` gl_FragColor = vec4(vec3(${inputExpr}), 1.0);`);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
const varName2 = `${this.variablePrefix}out_${this.sanitize(nodeId)}`;
|
|
192
|
-
this.nodeOutputVars.set(nodeId, varName2);
|
|
193
|
-
return varName2;
|
|
194
|
-
}
|
|
195
|
-
const codegen = NODE_TYPE_MAP[node.type];
|
|
196
|
-
if (!codegen) {
|
|
197
|
-
this.unsupportedNodes.push(node.type);
|
|
198
|
-
this.warnings.push(`Unsupported node type: ${node.type}; using default value`);
|
|
199
|
-
this.nodeOutputVars.set(nodeId, "0.0");
|
|
200
|
-
return "0.0";
|
|
201
|
-
}
|
|
202
|
-
const resolvedInputs = {};
|
|
203
|
-
for (const input of node.inputs) {
|
|
204
|
-
resolvedInputs[input.name] = this.resolveInputPort(nodeId, input.name, input);
|
|
205
|
-
}
|
|
206
|
-
let expression = codegen.expression;
|
|
207
|
-
for (const [portName, portExpr] of Object.entries(resolvedInputs)) {
|
|
208
|
-
expression = expression.replace(`{in:${portName}}`, portExpr);
|
|
209
|
-
}
|
|
210
|
-
expression = expression.replace(/\{in:\w+\}/g, "0.0");
|
|
211
|
-
const varName = `${this.variablePrefix}${this.sanitize(nodeId)}`;
|
|
212
|
-
const glslType = this.uniformTypeToGLSL(codegen.outputType);
|
|
213
|
-
this.fragmentLines.push(` ${glslType} ${varName} = ${expression};`);
|
|
214
|
-
this.nodeOutputVars.set(nodeId, varName);
|
|
215
|
-
return varName;
|
|
216
|
-
}
|
|
217
|
-
resolveInputPort(nodeId, portName, port) {
|
|
218
|
-
const edgeKey = `${nodeId}:${portName}`;
|
|
219
|
-
const edges = this.edgesByTarget.get(edgeKey);
|
|
220
|
-
if (edges && edges.length > 0) {
|
|
221
|
-
const edge = edges[0];
|
|
222
|
-
return this.traverseNode(edge.fromNode);
|
|
223
|
-
}
|
|
224
|
-
if (port.default !== void 0) {
|
|
225
|
-
if (typeof port.default === "number") return String(port.default);
|
|
226
|
-
if (Array.isArray(port.default)) {
|
|
227
|
-
const len = port.default.length;
|
|
228
|
-
if (len === 2) return `vec2(${port.default.join(", ")})`;
|
|
229
|
-
if (len === 3) return `vec3(${port.default.join(", ")})`;
|
|
230
|
-
if (len === 4) return `vec4(${port.default.join(", ")})`;
|
|
231
|
-
return String(port.default[0] ?? 0);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return "0.0";
|
|
235
|
-
}
|
|
236
|
-
resolveBuiltinNode(node) {
|
|
237
|
-
switch (node.type) {
|
|
238
|
-
case "Time":
|
|
239
|
-
return "time";
|
|
240
|
-
case "Resolution":
|
|
241
|
-
return "resolution";
|
|
242
|
-
case "UV":
|
|
243
|
-
case "ScreenUV":
|
|
244
|
-
this.ensureVarying("vUv", "vec2");
|
|
245
|
-
return "vUv";
|
|
246
|
-
case "Normal":
|
|
247
|
-
this.ensureVarying("vNormal", "vec3");
|
|
248
|
-
return "vNormal";
|
|
249
|
-
case "Position":
|
|
250
|
-
this.ensureVarying("vPosition", "vec3");
|
|
251
|
-
return "vPosition";
|
|
252
|
-
case "ViewDirection":
|
|
253
|
-
this.ensureVarying("vViewDir", "vec3");
|
|
254
|
-
return "vViewDir";
|
|
255
|
-
case "FragCoord":
|
|
256
|
-
return "gl_FragCoord.xy";
|
|
257
|
-
case "Constant": {
|
|
258
|
-
const val = node.params?.["value"];
|
|
259
|
-
if (typeof val === "number") return String(val);
|
|
260
|
-
if (Array.isArray(val)) {
|
|
261
|
-
if (val.length === 2) return `vec2(${val.join(", ")})`;
|
|
262
|
-
if (val.length === 3) return `vec3(${val.join(", ")})`;
|
|
263
|
-
if (val.length === 4) return `vec4(${val.join(", ")})`;
|
|
264
|
-
}
|
|
265
|
-
return "0.0";
|
|
266
|
-
}
|
|
267
|
-
case "Parameter": {
|
|
268
|
-
const name = node.params?.["name"] || `param_${node.id}`;
|
|
269
|
-
return name;
|
|
270
|
-
}
|
|
271
|
-
default:
|
|
272
|
-
return "0.0";
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
// ---------------------------------------------------------------------------
|
|
276
|
-
// Uniform and varying management
|
|
277
|
-
// ---------------------------------------------------------------------------
|
|
278
|
-
extractParameterUniform(node) {
|
|
279
|
-
const name = node.params?.["name"] || `param_${node.id}`;
|
|
280
|
-
const value = node.params?.["value"];
|
|
281
|
-
const uniformType = this.inferUniformType(value);
|
|
282
|
-
if (!this.uniforms[name]) {
|
|
283
|
-
this.uniforms[name] = {
|
|
284
|
-
type: uniformType,
|
|
285
|
-
value: typeof value === "number" || Array.isArray(value) ? value : 0,
|
|
286
|
-
min: node.params?.["min"],
|
|
287
|
-
max: node.params?.["max"],
|
|
288
|
-
label: node.label
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
inferUniformType(value) {
|
|
293
|
-
if (typeof value === "number") return "float";
|
|
294
|
-
if (typeof value === "boolean") return "bool";
|
|
295
|
-
if (Array.isArray(value)) {
|
|
296
|
-
if (value.length === 2) return "vec2";
|
|
297
|
-
if (value.length === 3) return "vec3";
|
|
298
|
-
if (value.length === 4) return "vec4";
|
|
299
|
-
if (value.length === 9) return "mat3";
|
|
300
|
-
if (value.length === 16) return "mat4";
|
|
301
|
-
}
|
|
302
|
-
return "float";
|
|
303
|
-
}
|
|
304
|
-
ensureVarying(name, type) {
|
|
305
|
-
const decl = `varying ${type} ${name};`;
|
|
306
|
-
if (!this.varyingDecls.includes(decl)) {
|
|
307
|
-
this.varyingDecls.push(decl);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
// ---------------------------------------------------------------------------
|
|
311
|
-
// Source generation
|
|
312
|
-
// ---------------------------------------------------------------------------
|
|
313
|
-
generateVertexSource() {
|
|
314
|
-
const lines = [];
|
|
315
|
-
for (const decl of this.varyingDecls) {
|
|
316
|
-
lines.push(decl);
|
|
317
|
-
}
|
|
318
|
-
lines.push("");
|
|
319
|
-
lines.push("void main() {");
|
|
320
|
-
if (this.varyingDecls.some((d) => d.includes("vUv"))) {
|
|
321
|
-
lines.push(" vUv = uv;");
|
|
322
|
-
}
|
|
323
|
-
if (this.varyingDecls.some((d) => d.includes("vNormal"))) {
|
|
324
|
-
lines.push(" vNormal = normalize(normalMatrix * normal);");
|
|
325
|
-
}
|
|
326
|
-
if (this.varyingDecls.some((d) => d.includes("vPosition"))) {
|
|
327
|
-
lines.push(" vPosition = position;");
|
|
328
|
-
}
|
|
329
|
-
if (this.varyingDecls.some((d) => d.includes("vViewDir"))) {
|
|
330
|
-
lines.push(" vec4 mvPos = modelViewMatrix * vec4(position, 1.0);");
|
|
331
|
-
lines.push(" vViewDir = normalize(-mvPos.xyz);");
|
|
332
|
-
}
|
|
333
|
-
lines.push(" gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);");
|
|
334
|
-
lines.push("}");
|
|
335
|
-
return lines.join("\n");
|
|
336
|
-
}
|
|
337
|
-
generateFragmentSource(outputNodes) {
|
|
338
|
-
const lines = [];
|
|
339
|
-
lines.push("precision highp float;");
|
|
340
|
-
lines.push("");
|
|
341
|
-
for (const [name, uniform] of Object.entries(this.uniforms)) {
|
|
342
|
-
lines.push(`uniform ${this.uniformTypeToGLSL(uniform.type)} ${name};`);
|
|
343
|
-
}
|
|
344
|
-
lines.push("");
|
|
345
|
-
for (const decl of this.varyingDecls) {
|
|
346
|
-
lines.push(decl);
|
|
347
|
-
}
|
|
348
|
-
lines.push("");
|
|
349
|
-
if (this.nodeMap.size > 0) {
|
|
350
|
-
const hasNoise = Array.from(this.nodeMap.values()).some((n) => n.type === "ProceduralNoise");
|
|
351
|
-
if (hasNoise) {
|
|
352
|
-
lines.push(SIMPLEX_NOISE_2D);
|
|
353
|
-
lines.push("");
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
lines.push("void main() {");
|
|
357
|
-
for (const line of this.fragmentLines) {
|
|
358
|
-
lines.push(line);
|
|
359
|
-
}
|
|
360
|
-
if (!this.fragmentLines.some((l) => l.includes("gl_FragColor"))) {
|
|
361
|
-
lines.push(" gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0); // No output node");
|
|
362
|
-
}
|
|
363
|
-
lines.push("}");
|
|
364
|
-
return lines.join("\n");
|
|
365
|
-
}
|
|
366
|
-
// ---------------------------------------------------------------------------
|
|
367
|
-
// Helpers
|
|
368
|
-
// ---------------------------------------------------------------------------
|
|
369
|
-
uniformTypeToGLSL(type) {
|
|
370
|
-
return type;
|
|
371
|
-
}
|
|
372
|
-
sanitize(id) {
|
|
373
|
-
return id.replace(/[^a-zA-Z0-9]/g, "_");
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
var SIMPLEX_NOISE_2D = `
|
|
377
|
-
// Simplex 2D noise for ProceduralNoise nodes
|
|
378
|
-
vec3 mod289_n(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
|
379
|
-
vec2 mod289_n(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
|
380
|
-
vec3 permute_n(vec3 x) { return mod289_n(((x*34.0)+1.0)*x); }
|
|
381
|
-
|
|
382
|
-
float snoise(vec2 v) {
|
|
383
|
-
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
|
|
384
|
-
-0.577350269189626, 0.024390243902439);
|
|
385
|
-
vec2 i = floor(v + dot(v, C.yy));
|
|
386
|
-
vec2 x0 = v - i + dot(i, C.xx);
|
|
387
|
-
vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
388
|
-
vec4 x12 = x0.xyxy + C.xxzz;
|
|
389
|
-
x12.xy -= i1;
|
|
390
|
-
i = mod289_n(i);
|
|
391
|
-
vec3 p = permute_n(permute_n(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));
|
|
392
|
-
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);
|
|
393
|
-
m = m*m; m = m*m;
|
|
394
|
-
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
|
395
|
-
vec3 h = abs(x) - 0.5;
|
|
396
|
-
vec3 ox = floor(x + 0.5);
|
|
397
|
-
vec3 a0 = x - ox;
|
|
398
|
-
m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);
|
|
399
|
-
vec3 g;
|
|
400
|
-
g.x = a0.x * x0.x + h.x * x0.y;
|
|
401
|
-
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
|
402
|
-
return 130.0 * dot(m, g);
|
|
403
|
-
}`.trim();
|
|
404
|
-
var NodeToyMapping_default = mapNodeToyToShader;
|
|
405
|
-
|
|
406
|
-
exports.NodeToyMapper = NodeToyMapper;
|
|
407
|
-
exports.NodeToyMapping_default = NodeToyMapping_default;
|
|
408
|
-
exports.mapNodeToyToShader = mapNodeToyToShader;
|
|
409
|
-
//# sourceMappingURL=chunk-27LWW5FU.cjs.map
|
|
410
|
-
//# sourceMappingURL=chunk-27LWW5FU.cjs.map
|
package/dist/chunk-2CWOLHTE.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __typeError = (msg) => {
|
|
8
|
-
throw TypeError(msg);
|
|
9
|
-
};
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
12
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
13
|
-
}) : x)(function(x) {
|
|
14
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
15
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
16
|
-
});
|
|
17
|
-
var __esm = (fn, res) => function __init() {
|
|
18
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
19
|
-
};
|
|
20
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
21
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
22
|
-
};
|
|
23
|
-
var __export = (target, all) => {
|
|
24
|
-
for (var name in all)
|
|
25
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
-
};
|
|
27
|
-
var __copyProps = (to, from, except, desc) => {
|
|
28
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
-
for (let key of __getOwnPropNames(from))
|
|
30
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
|
-
}
|
|
33
|
-
return to;
|
|
34
|
-
};
|
|
35
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
36
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
37
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
38
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
39
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
40
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
41
|
-
mod
|
|
42
|
-
));
|
|
43
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
44
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
45
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
46
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
47
|
-
if (decorator = decorators[i])
|
|
48
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
49
|
-
if (kind && result) __defProp(target, key, result);
|
|
50
|
-
return result;
|
|
51
|
-
};
|
|
52
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
53
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
54
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
55
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
56
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
57
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
58
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
59
|
-
set _(value) {
|
|
60
|
-
__privateSet(obj, member, value, setter);
|
|
61
|
-
},
|
|
62
|
-
get _() {
|
|
63
|
-
return __privateGet(obj, member, getter);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
export { __commonJS, __decorateClass, __esm, __export, __privateAdd, __privateGet, __privateMethod, __privateSet, __privateWrapper, __publicField, __require, __toCommonJS, __toESM };
|
|
68
|
-
//# sourceMappingURL=chunk-2CWOLHTE.js.map
|
|
69
|
-
//# sourceMappingURL=chunk-2CWOLHTE.js.map
|