@shaderfrog/core 1.1.0 → 1.1.2
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/engine.js → engine.js} +28 -19
- package/graph/base-node.js +13 -0
- package/{dist/graph → graph}/code-nodes.js +9 -4
- package/{dist/graph → graph}/context.js +39 -29
- package/{dist/graph → graph}/data-nodes.js +27 -12
- package/graph/edge.js +12 -0
- package/{dist/graph → graph}/evaluate.js +10 -5
- package/{dist/graph → graph}/graph-node.js +28 -20
- package/{dist/graph → graph}/graph-types.js +10 -7
- package/{dist/graph → graph}/graph.js +129 -102
- package/{dist/graph → graph}/graph.test.js +41 -36
- package/graph/index.js +27 -0
- package/{dist/graph → graph}/parsers.js +45 -39
- package/{dist/graph → graph}/shader-sections.js +36 -24
- package/index.js +19 -0
- package/package.json +10 -2
- package/{dist/plugins → plugins}/babylon/bablyengine.js +86 -78
- package/{dist/plugins → plugins}/babylon/importers.js +7 -5
- package/plugins/babylon/index.js +5 -0
- package/{dist/plugins → plugins}/playcanvas/importers.js +5 -3
- package/plugins/playcanvas/index.js +5 -0
- package/{dist/plugins → plugins}/playcanvas/playengine.js +96 -64
- package/{dist/plugins → plugins}/three/importers.js +5 -3
- package/plugins/three/index.js +6 -0
- package/{dist/plugins → plugins}/three/threngine.js +122 -111
- package/strategy/assignemntTo.js +31 -0
- package/strategy/declarationOf.js +28 -0
- package/{dist/strategy → strategy}/hardCode.js +9 -4
- package/strategy/index.js +25 -0
- package/{dist/strategy → strategy}/inject.js +13 -8
- package/{dist/strategy → strategy}/namedAttribute.js +13 -8
- package/strategy/strategy.js +35 -0
- package/{dist/strategy → strategy}/stratgies.test.js +59 -31
- package/{dist/strategy → strategy}/texture2D.js +15 -10
- package/{dist/strategy → strategy}/uniform.js +17 -12
- package/{dist/strategy → strategy}/variable.js +14 -9
- package/{dist/util → util}/ast.js +59 -40
- package/{dist/util → util}/ensure.js +5 -1
- package/util/id.js +6 -0
- package/dist/graph/base-node.js +0 -9
- package/dist/graph/edge.js +0 -7
- package/dist/graph/index.js +0 -11
- package/dist/index.js +0 -3
- package/dist/plugins/babylon/index.js +0 -2
- package/dist/plugins/playcanvas/index.js +0 -2
- package/dist/plugins/three/index.js +0 -2
- package/dist/strategy/assignemntTo.js +0 -26
- package/dist/strategy/declarationOf.js +0 -23
- package/dist/strategy/index.js +0 -9
- package/dist/strategy/strategy.js +0 -31
- package/dist/util/id.js +0 -2
- /package/{dist/engine.d.ts → engine.d.ts} +0 -0
- /package/{dist/graph → graph}/base-node.d.ts +0 -0
- /package/{dist/graph → graph}/code-nodes.d.ts +0 -0
- /package/{dist/graph → graph}/context.d.ts +0 -0
- /package/{dist/graph → graph}/data-nodes.d.ts +0 -0
- /package/{dist/graph → graph}/edge.d.ts +0 -0
- /package/{dist/graph → graph}/evaluate.d.ts +0 -0
- /package/{dist/graph → graph}/graph-node.d.ts +0 -0
- /package/{dist/graph → graph}/graph-types.d.ts +0 -0
- /package/{dist/graph → graph}/graph.d.ts +0 -0
- /package/{dist/graph → graph}/graph.test.d.ts +0 -0
- /package/{dist/graph → graph}/index.d.ts +0 -0
- /package/{dist/graph → graph}/parsers.d.ts +0 -0
- /package/{dist/graph → graph}/shader-sections.d.ts +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/plugins → plugins}/babylon/bablyengine.d.ts +0 -0
- /package/{dist/plugins → plugins}/babylon/importers.d.ts +0 -0
- /package/{dist/plugins → plugins}/babylon/index.d.ts +0 -0
- /package/{dist/plugins → plugins}/playcanvas/importers.d.ts +0 -0
- /package/{dist/plugins → plugins}/playcanvas/index.d.ts +0 -0
- /package/{dist/plugins → plugins}/playcanvas/playengine.d.ts +0 -0
- /package/{dist/plugins → plugins}/three/importers.d.ts +0 -0
- /package/{dist/plugins → plugins}/three/index.d.ts +0 -0
- /package/{dist/plugins → plugins}/three/threngine.d.ts +0 -0
- /package/{dist/strategy → strategy}/assignemntTo.d.ts +0 -0
- /package/{dist/strategy → strategy}/declarationOf.d.ts +0 -0
- /package/{dist/strategy → strategy}/hardCode.d.ts +0 -0
- /package/{dist/strategy → strategy}/index.d.ts +0 -0
- /package/{dist/strategy → strategy}/inject.d.ts +0 -0
- /package/{dist/strategy → strategy}/namedAttribute.d.ts +0 -0
- /package/{dist/strategy → strategy}/strategy.d.ts +0 -0
- /package/{dist/strategy → strategy}/stratgies.test.d.ts +0 -0
- /package/{dist/strategy → strategy}/texture2D.d.ts +0 -0
- /package/{dist/strategy → strategy}/uniform.d.ts +0 -0
- /package/{dist/strategy → strategy}/variable.d.ts +0 -0
- /package/{dist/util → util}/ast.d.ts +0 -0
- /package/{dist/util → util}/ensure.d.ts +0 -0
- /package/{dist/util → util}/id.d.ts +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __assign = (this && this.__assign) || function () {
|
|
2
3
|
__assign = Object.assign || function(t) {
|
|
3
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -70,16 +71,21 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
70
71
|
}
|
|
71
72
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
72
73
|
};
|
|
74
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
75
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
76
|
+
};
|
|
73
77
|
var _a, _b;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
|
+
exports.createMaterial = exports.threngine = exports.toonNode = exports.defaultPropertySetting = exports.physicalNode = exports.phongNode = void 0;
|
|
80
|
+
var three_1 = require("three");
|
|
81
|
+
var graph_types_1 = require("../../graph/graph-types");
|
|
82
|
+
var graph_1 = require("../../graph/graph");
|
|
83
|
+
var importers_1 = __importDefault(require("./importers"));
|
|
84
|
+
var engine_1 = require("../../engine");
|
|
85
|
+
var graph_2 = require("../../graph/graph");
|
|
86
|
+
var ast_1 = require("../../util/ast");
|
|
87
|
+
var code_nodes_1 = require("../../graph/code-nodes");
|
|
88
|
+
var strategy_1 = require("../../strategy");
|
|
83
89
|
var log = function () {
|
|
84
90
|
var _a;
|
|
85
91
|
var args = [];
|
|
@@ -88,42 +94,42 @@ var log = function () {
|
|
|
88
94
|
}
|
|
89
95
|
return (_a = console.log).call.apply(_a, __spreadArray([console, '\x1b[35m(three)\x1b[0m'], __read(args), false));
|
|
90
96
|
};
|
|
91
|
-
|
|
92
|
-
return prepopulatePropertyInputs({
|
|
97
|
+
var phongNode = function (id, name, position, uniforms, stage) {
|
|
98
|
+
return (0, graph_1.prepopulatePropertyInputs)({
|
|
93
99
|
id: id,
|
|
94
100
|
name: 'MeshPhongMaterial',
|
|
95
101
|
position: position,
|
|
96
102
|
engine: true,
|
|
97
|
-
type: EngineNodeType.phong,
|
|
103
|
+
type: engine_1.EngineNodeType.phong,
|
|
98
104
|
config: {
|
|
99
105
|
version: 3,
|
|
100
106
|
uniforms: uniforms,
|
|
101
107
|
preprocess: true,
|
|
102
108
|
mangle: false,
|
|
103
109
|
properties: [
|
|
104
|
-
property('Color', 'color', 'rgb', 'uniform_diffuse'),
|
|
105
|
-
property('Emissive', 'emissive', 'rgb', 'uniform_emissive'),
|
|
106
|
-
property('Emissive Map', 'emissiveMap', 'texture', 'filler_emissiveMap'),
|
|
107
|
-
property('Emissive Intensity', 'emissiveIntensity', 'number', 'uniform_emissive'),
|
|
108
|
-
property('Texture', 'map', 'texture', 'filler_map'),
|
|
109
|
-
property('Normal Map', 'normalMap', 'texture', 'filler_normalMap'),
|
|
110
|
-
property('Normal Scale', 'normalScale', 'vector2'),
|
|
111
|
-
property('AO Map', 'aoMap', 'texture', 'filler_aoMap'),
|
|
112
|
-
property('AO Intensity', 'aoMapIntensity', 'number', 'filler_aoMapIntensity'),
|
|
113
|
-
property('Shininess', 'shininess', 'number'),
|
|
114
|
-
property('Reflectivity', 'reflectivity', 'number'),
|
|
115
|
-
property('Refraction Ratio', 'refractionRatio', 'number'),
|
|
116
|
-
property('Specular', 'specular', 'rgb', 'uniform_specular'),
|
|
117
|
-
property('Specular Map', 'specularMap', 'texture', 'filler_specularMap'),
|
|
118
|
-
property('Displacement Map', 'displacementMap', 'texture', 'filler_displacementMap'),
|
|
119
|
-
property('Displacement Scale', 'displacementScale', 'number'),
|
|
120
|
-
property('Env Map', 'envMap', 'samplerCube'),
|
|
110
|
+
(0, code_nodes_1.property)('Color', 'color', 'rgb', 'uniform_diffuse'),
|
|
111
|
+
(0, code_nodes_1.property)('Emissive', 'emissive', 'rgb', 'uniform_emissive'),
|
|
112
|
+
(0, code_nodes_1.property)('Emissive Map', 'emissiveMap', 'texture', 'filler_emissiveMap'),
|
|
113
|
+
(0, code_nodes_1.property)('Emissive Intensity', 'emissiveIntensity', 'number', 'uniform_emissive'),
|
|
114
|
+
(0, code_nodes_1.property)('Texture', 'map', 'texture', 'filler_map'),
|
|
115
|
+
(0, code_nodes_1.property)('Normal Map', 'normalMap', 'texture', 'filler_normalMap'),
|
|
116
|
+
(0, code_nodes_1.property)('Normal Scale', 'normalScale', 'vector2'),
|
|
117
|
+
(0, code_nodes_1.property)('AO Map', 'aoMap', 'texture', 'filler_aoMap'),
|
|
118
|
+
(0, code_nodes_1.property)('AO Intensity', 'aoMapIntensity', 'number', 'filler_aoMapIntensity'),
|
|
119
|
+
(0, code_nodes_1.property)('Shininess', 'shininess', 'number'),
|
|
120
|
+
(0, code_nodes_1.property)('Reflectivity', 'reflectivity', 'number'),
|
|
121
|
+
(0, code_nodes_1.property)('Refraction Ratio', 'refractionRatio', 'number'),
|
|
122
|
+
(0, code_nodes_1.property)('Specular', 'specular', 'rgb', 'uniform_specular'),
|
|
123
|
+
(0, code_nodes_1.property)('Specular Map', 'specularMap', 'texture', 'filler_specularMap'),
|
|
124
|
+
(0, code_nodes_1.property)('Displacement Map', 'displacementMap', 'texture', 'filler_displacementMap'),
|
|
125
|
+
(0, code_nodes_1.property)('Displacement Scale', 'displacementScale', 'number'),
|
|
126
|
+
(0, code_nodes_1.property)('Env Map', 'envMap', 'samplerCube'),
|
|
121
127
|
],
|
|
122
128
|
strategies: [
|
|
123
|
-
uniformStrategy(),
|
|
129
|
+
(0, strategy_1.uniformStrategy)(),
|
|
124
130
|
stage === 'fragment'
|
|
125
|
-
? texture2DStrategy()
|
|
126
|
-
: namedAttributeStrategy('position'),
|
|
131
|
+
? (0, strategy_1.texture2DStrategy)()
|
|
132
|
+
: (0, strategy_1.namedAttributeStrategy)('position'),
|
|
127
133
|
],
|
|
128
134
|
},
|
|
129
135
|
inputs: [],
|
|
@@ -139,56 +145,57 @@ export var phongNode = function (id, name, position, uniforms, stage) {
|
|
|
139
145
|
stage: stage,
|
|
140
146
|
});
|
|
141
147
|
};
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
exports.phongNode = phongNode;
|
|
149
|
+
var physicalNode = function (id, name, position, uniforms, stage) {
|
|
150
|
+
return (0, graph_1.prepopulatePropertyInputs)({
|
|
144
151
|
id: id,
|
|
145
152
|
name: 'MeshPhysicalMaterial',
|
|
146
153
|
position: position,
|
|
147
154
|
engine: true,
|
|
148
|
-
type: EngineNodeType.physical,
|
|
155
|
+
type: engine_1.EngineNodeType.physical,
|
|
149
156
|
config: {
|
|
150
157
|
uniforms: uniforms,
|
|
151
158
|
version: 3,
|
|
152
159
|
mangle: false,
|
|
153
160
|
preprocess: true,
|
|
154
161
|
properties: [
|
|
155
|
-
property('Color', 'color', 'rgb', 'uniform_diffuse'),
|
|
156
|
-
property('Texture', 'map', 'texture', 'filler_map'),
|
|
157
|
-
property('Opacity', 'opacity', 'number'),
|
|
158
|
-
property('Normal Map', 'normalMap', 'texture', 'filler_normalMap'),
|
|
159
|
-
property('Normal Scale', 'normalScale', 'vector2'),
|
|
160
|
-
property('AO Map', 'aoMap', 'texture', 'filler_aoMap'),
|
|
161
|
-
property('AO Intensity', 'aoMapIntensity', 'number', 'filler_aoMapIntensity'),
|
|
162
|
-
property('Metalness', 'metalness', 'number', 'uniform_metalness'),
|
|
163
|
-
property('Roughness', 'roughness', 'number', 'uniform_roughness'),
|
|
164
|
-
property('Roughness Map', 'roughnessMap', 'texture', 'filler_roughnessMap'),
|
|
165
|
-
property('Displacement Map', 'displacementMap', 'texture', 'filler_displacementMap'),
|
|
166
|
-
property('Displacement Scale', 'displacementScale', 'number'),
|
|
162
|
+
(0, code_nodes_1.property)('Color', 'color', 'rgb', 'uniform_diffuse'),
|
|
163
|
+
(0, code_nodes_1.property)('Texture', 'map', 'texture', 'filler_map'),
|
|
164
|
+
(0, code_nodes_1.property)('Opacity', 'opacity', 'number'),
|
|
165
|
+
(0, code_nodes_1.property)('Normal Map', 'normalMap', 'texture', 'filler_normalMap'),
|
|
166
|
+
(0, code_nodes_1.property)('Normal Scale', 'normalScale', 'vector2'),
|
|
167
|
+
(0, code_nodes_1.property)('AO Map', 'aoMap', 'texture', 'filler_aoMap'),
|
|
168
|
+
(0, code_nodes_1.property)('AO Intensity', 'aoMapIntensity', 'number', 'filler_aoMapIntensity'),
|
|
169
|
+
(0, code_nodes_1.property)('Metalness', 'metalness', 'number', 'uniform_metalness'),
|
|
170
|
+
(0, code_nodes_1.property)('Roughness', 'roughness', 'number', 'uniform_roughness'),
|
|
171
|
+
(0, code_nodes_1.property)('Roughness Map', 'roughnessMap', 'texture', 'filler_roughnessMap'),
|
|
172
|
+
(0, code_nodes_1.property)('Displacement Map', 'displacementMap', 'texture', 'filler_displacementMap'),
|
|
173
|
+
(0, code_nodes_1.property)('Displacement Scale', 'displacementScale', 'number'),
|
|
167
174
|
// MeshPhysicalMaterial gets envMap from the scene. MeshStandardMaterial
|
|
168
175
|
// gets it from the material
|
|
169
176
|
// property('Env Map', 'envMap', 'samplerCube'),
|
|
170
|
-
property('Transmission', 'transmission', 'number'),
|
|
171
|
-
property('Transmission Map', 'transmissionMap', 'texture', 'filler_transmissionMap'),
|
|
172
|
-
property('Thickness', 'thickness', 'number'),
|
|
173
|
-
property('Index of Refraction', 'ior', 'number'),
|
|
177
|
+
(0, code_nodes_1.property)('Transmission', 'transmission', 'number'),
|
|
178
|
+
(0, code_nodes_1.property)('Transmission Map', 'transmissionMap', 'texture', 'filler_transmissionMap'),
|
|
179
|
+
(0, code_nodes_1.property)('Thickness', 'thickness', 'number'),
|
|
180
|
+
(0, code_nodes_1.property)('Index of Refraction', 'ior', 'number'),
|
|
174
181
|
// Sheen only works with directional lights?
|
|
175
182
|
// https://discourse.threejs.org/t/meshphysicalmaterial-s-sheen/31901/6
|
|
176
183
|
// property('Sheen', 'sheen', 'number'),
|
|
177
|
-
property('Reflectivity', 'reflectivity', 'number'),
|
|
178
|
-
property('Clearcoat', 'clearcoat', 'number'),
|
|
179
|
-
property('Iridescence', 'iridescence', 'number'),
|
|
180
|
-
property('Iridescence IOR', 'iridescenceIOR', 'number'),
|
|
181
|
-
property('Iridescence Thickness Range', 'iridescenceThicknessRange', 'array', undefined, ['100', '400']),
|
|
184
|
+
(0, code_nodes_1.property)('Reflectivity', 'reflectivity', 'number'),
|
|
185
|
+
(0, code_nodes_1.property)('Clearcoat', 'clearcoat', 'number'),
|
|
186
|
+
(0, code_nodes_1.property)('Iridescence', 'iridescence', 'number'),
|
|
187
|
+
(0, code_nodes_1.property)('Iridescence IOR', 'iridescenceIOR', 'number'),
|
|
188
|
+
(0, code_nodes_1.property)('Iridescence Thickness Range', 'iridescenceThicknessRange', 'array', undefined, ['100', '400']),
|
|
182
189
|
],
|
|
183
190
|
hardCodedProperties: {
|
|
184
191
|
isMeshPhysicalMaterial: true,
|
|
185
192
|
isMeshStandardMaterial: true,
|
|
186
193
|
},
|
|
187
194
|
strategies: [
|
|
188
|
-
uniformStrategy(),
|
|
195
|
+
(0, strategy_1.uniformStrategy)(),
|
|
189
196
|
stage === 'fragment'
|
|
190
|
-
? texture2DStrategy()
|
|
191
|
-
: namedAttributeStrategy('position'),
|
|
197
|
+
? (0, strategy_1.texture2DStrategy)()
|
|
198
|
+
: (0, strategy_1.namedAttributeStrategy)('position'),
|
|
192
199
|
],
|
|
193
200
|
},
|
|
194
201
|
inputs: [],
|
|
@@ -204,6 +211,7 @@ export var physicalNode = function (id, name, position, uniforms, stage) {
|
|
|
204
211
|
stage: stage,
|
|
205
212
|
});
|
|
206
213
|
};
|
|
214
|
+
exports.physicalNode = physicalNode;
|
|
207
215
|
var cacher = function (engineContext, graph, node, sibling, newValue) {
|
|
208
216
|
var cacheKey = programCacheKey(engineContext, graph, node, sibling);
|
|
209
217
|
if (engineContext.runtime.cache.data[cacheKey]) {
|
|
@@ -262,18 +270,18 @@ var onBeforeCompileMegaShader = function (engineContext, newMat) {
|
|
|
262
270
|
};
|
|
263
271
|
var megaShaderMainpulateAst = function (engineContext, engine, graph, ast, inputEdges, node, sibling) {
|
|
264
272
|
var programAst = ast;
|
|
265
|
-
var mainName = 'main' || nodeName(node);
|
|
273
|
+
var mainName = 'main' || (0, graph_2.nodeName)(node);
|
|
266
274
|
if (node.stage === 'vertex') {
|
|
267
|
-
if (doesLinkThruShader(graph, node)) {
|
|
268
|
-
returnGlPositionHardCoded(mainName, programAst, 'vec3', 'transformed');
|
|
275
|
+
if ((0, graph_2.doesLinkThruShader)(graph, node)) {
|
|
276
|
+
(0, ast_1.returnGlPositionHardCoded)(mainName, programAst, 'vec3', 'transformed');
|
|
269
277
|
}
|
|
270
278
|
else {
|
|
271
|
-
returnGlPosition(mainName, programAst);
|
|
279
|
+
(0, ast_1.returnGlPosition)(mainName, programAst);
|
|
272
280
|
}
|
|
273
281
|
}
|
|
274
282
|
// We specify engine nodes are mangle: false, which is the graph step that
|
|
275
283
|
// handles renaming the main fn, so we have to do it ourselves
|
|
276
|
-
mangleMainFn(programAst, node, sibling);
|
|
284
|
+
(0, graph_1.mangleMainFn)(programAst, node, sibling);
|
|
277
285
|
return programAst;
|
|
278
286
|
};
|
|
279
287
|
var nodeCacheKey = function (graph, node) {
|
|
@@ -298,7 +306,7 @@ var programCacheKey = function (engineContext, graph, node, sibling) {
|
|
|
298
306
|
var scene = engineContext.runtime.scene;
|
|
299
307
|
var lights = [];
|
|
300
308
|
scene.traverse(function (obj) {
|
|
301
|
-
if (obj instanceof Light) {
|
|
309
|
+
if (obj instanceof three_1.Light) {
|
|
302
310
|
lights.push(obj.type);
|
|
303
311
|
}
|
|
304
312
|
});
|
|
@@ -312,20 +320,21 @@ var programCacheKey = function (engineContext, graph, node, sibling) {
|
|
|
312
320
|
'|Envtex:' +
|
|
313
321
|
scene.environmentTexture);
|
|
314
322
|
};
|
|
315
|
-
|
|
323
|
+
var defaultPropertySetting = function (property) {
|
|
316
324
|
if (property.type === 'texture') {
|
|
317
|
-
return new Texture();
|
|
325
|
+
return new three_1.Texture();
|
|
318
326
|
}
|
|
319
327
|
else if (property.type === 'number') {
|
|
320
328
|
return 0.5;
|
|
321
329
|
}
|
|
322
330
|
else if (property.type === 'rgb') {
|
|
323
|
-
return new Color(1, 1, 1);
|
|
331
|
+
return new three_1.Color(1, 1, 1);
|
|
324
332
|
}
|
|
325
333
|
else if (property.type === 'rgba') {
|
|
326
|
-
return new Vector4(1, 1, 1, 1);
|
|
334
|
+
return new three_1.Vector4(1, 1, 1, 1);
|
|
327
335
|
}
|
|
328
336
|
};
|
|
337
|
+
exports.defaultPropertySetting = defaultPropertySetting;
|
|
329
338
|
var threeMaterialProperties = function (graph, node, sibling) {
|
|
330
339
|
// Find inputs to this node that are dependent on a property of the material
|
|
331
340
|
var propertyInputs = node.inputs
|
|
@@ -344,7 +353,7 @@ var threeMaterialProperties = function (graph, node, sibling) {
|
|
|
344
353
|
// Find the property itself
|
|
345
354
|
var property_1 = (node.config.properties || []).find(function (p) { return p.property === propertyInput.property; });
|
|
346
355
|
// Initialize the property on the material
|
|
347
|
-
acc[property_1.property] = defaultPropertySetting(property_1);
|
|
356
|
+
acc[property_1.property] = (0, exports.defaultPropertySetting)(property_1);
|
|
348
357
|
}
|
|
349
358
|
return acc;
|
|
350
359
|
}, {});
|
|
@@ -354,53 +363,53 @@ var evaluateNode = function (node) {
|
|
|
354
363
|
return parseFloat(node.value);
|
|
355
364
|
}
|
|
356
365
|
if (node.type === 'vector2') {
|
|
357
|
-
return new Vector2(parseFloat(node.value[0]), parseFloat(node.value[1]));
|
|
366
|
+
return new three_1.Vector2(parseFloat(node.value[0]), parseFloat(node.value[1]));
|
|
358
367
|
}
|
|
359
368
|
else if (node.type === 'vector3') {
|
|
360
|
-
return new Vector3(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]));
|
|
369
|
+
return new three_1.Vector3(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]));
|
|
361
370
|
}
|
|
362
371
|
else if (node.type === 'vector4') {
|
|
363
|
-
return new Vector4(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]), parseFloat(node.value[3]));
|
|
372
|
+
return new three_1.Vector4(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]), parseFloat(node.value[3]));
|
|
364
373
|
}
|
|
365
374
|
else if (node.type === 'rgb') {
|
|
366
|
-
return new Color(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]));
|
|
375
|
+
return new three_1.Color(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]));
|
|
367
376
|
}
|
|
368
377
|
else if (node.type === 'rgba') {
|
|
369
|
-
return new Vector4(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]), parseFloat(node.value[3]));
|
|
378
|
+
return new three_1.Vector4(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]), parseFloat(node.value[3]));
|
|
370
379
|
}
|
|
371
380
|
else {
|
|
372
381
|
return node.value;
|
|
373
382
|
}
|
|
374
383
|
};
|
|
375
|
-
|
|
376
|
-
return prepopulatePropertyInputs({
|
|
384
|
+
var toonNode = function (id, name, position, uniforms, stage) {
|
|
385
|
+
return (0, graph_1.prepopulatePropertyInputs)({
|
|
377
386
|
id: id,
|
|
378
387
|
name: 'MeshToonMaterial',
|
|
379
388
|
position: position,
|
|
380
389
|
engine: true,
|
|
381
|
-
type: EngineNodeType.toon,
|
|
390
|
+
type: engine_1.EngineNodeType.toon,
|
|
382
391
|
config: {
|
|
383
392
|
uniforms: uniforms,
|
|
384
393
|
version: 3,
|
|
385
394
|
preprocess: true,
|
|
386
395
|
mangle: false,
|
|
387
396
|
properties: [
|
|
388
|
-
property('Color', 'color', 'rgb', 'uniform_diffuse'),
|
|
389
|
-
property('Texture', 'map', 'texture', 'filler_map'),
|
|
390
|
-
property('Gradient Map', 'gradientMap', 'texture', 'filler_gradientMap'),
|
|
391
|
-
property('Normal Map', 'normalMap', 'texture', 'filler_normalMap'),
|
|
392
|
-
property('Normal Scale', 'normalScale', 'vector2'),
|
|
393
|
-
property('AO Map', 'aoMap', 'texture', 'filler_aoMap'),
|
|
394
|
-
property('AO Intensity', 'aoMapIntensity', 'number', 'filler_aoMapIntensity'),
|
|
395
|
-
property('Displacement Map', 'displacementMap', 'texture', 'filler_displacementMap'),
|
|
396
|
-
property('Displacement Scale', 'displacementScale', 'number'),
|
|
397
|
-
property('Env Map', 'envMap', 'samplerCube'),
|
|
397
|
+
(0, code_nodes_1.property)('Color', 'color', 'rgb', 'uniform_diffuse'),
|
|
398
|
+
(0, code_nodes_1.property)('Texture', 'map', 'texture', 'filler_map'),
|
|
399
|
+
(0, code_nodes_1.property)('Gradient Map', 'gradientMap', 'texture', 'filler_gradientMap'),
|
|
400
|
+
(0, code_nodes_1.property)('Normal Map', 'normalMap', 'texture', 'filler_normalMap'),
|
|
401
|
+
(0, code_nodes_1.property)('Normal Scale', 'normalScale', 'vector2'),
|
|
402
|
+
(0, code_nodes_1.property)('AO Map', 'aoMap', 'texture', 'filler_aoMap'),
|
|
403
|
+
(0, code_nodes_1.property)('AO Intensity', 'aoMapIntensity', 'number', 'filler_aoMapIntensity'),
|
|
404
|
+
(0, code_nodes_1.property)('Displacement Map', 'displacementMap', 'texture', 'filler_displacementMap'),
|
|
405
|
+
(0, code_nodes_1.property)('Displacement Scale', 'displacementScale', 'number'),
|
|
406
|
+
(0, code_nodes_1.property)('Env Map', 'envMap', 'samplerCube'),
|
|
398
407
|
],
|
|
399
408
|
strategies: [
|
|
400
|
-
uniformStrategy(),
|
|
409
|
+
(0, strategy_1.uniformStrategy)(),
|
|
401
410
|
stage === 'fragment'
|
|
402
|
-
? texture2DStrategy()
|
|
403
|
-
: namedAttributeStrategy('position'),
|
|
411
|
+
? (0, strategy_1.texture2DStrategy)()
|
|
412
|
+
: (0, strategy_1.namedAttributeStrategy)('position'),
|
|
404
413
|
],
|
|
405
414
|
},
|
|
406
415
|
inputs: [],
|
|
@@ -416,19 +425,20 @@ export var toonNode = function (id, name, position, uniforms, stage) {
|
|
|
416
425
|
stage: stage,
|
|
417
426
|
});
|
|
418
427
|
};
|
|
419
|
-
|
|
428
|
+
exports.toonNode = toonNode;
|
|
429
|
+
exports.threngine = {
|
|
420
430
|
name: 'three',
|
|
421
431
|
displayName: 'Three.js',
|
|
422
|
-
importers:
|
|
432
|
+
importers: importers_1.default,
|
|
423
433
|
mergeOptions: {
|
|
424
434
|
includePrecisions: true,
|
|
425
435
|
includeVersion: true,
|
|
426
436
|
},
|
|
427
437
|
evaluateNode: evaluateNode,
|
|
428
438
|
constructors: (_a = {},
|
|
429
|
-
_a[EngineNodeType.phong] = phongNode,
|
|
430
|
-
_a[EngineNodeType.physical] = physicalNode,
|
|
431
|
-
_a[EngineNodeType.toon] = toonNode,
|
|
439
|
+
_a[engine_1.EngineNodeType.phong] = exports.phongNode,
|
|
440
|
+
_a[engine_1.EngineNodeType.physical] = exports.physicalNode,
|
|
441
|
+
_a[engine_1.EngineNodeType.toon] = exports.toonNode,
|
|
432
442
|
_a),
|
|
433
443
|
// TODO: Get from uniform lib?
|
|
434
444
|
preserve: new Set([
|
|
@@ -504,27 +514,27 @@ export var threngine = {
|
|
|
504
514
|
'displacementBias',
|
|
505
515
|
]),
|
|
506
516
|
parsers: (_b = {},
|
|
507
|
-
_b[NodeType.SOURCE] = {
|
|
517
|
+
_b[graph_types_1.NodeType.SOURCE] = {
|
|
508
518
|
manipulateAst: function (engineContext, engine, graph, ast, inputEdges, node, sibling) {
|
|
509
519
|
var programAst = ast;
|
|
510
|
-
var mainName = 'main' || nodeName(node);
|
|
520
|
+
var mainName = 'main' || (0, graph_2.nodeName)(node);
|
|
511
521
|
// This hinges on the vertex shader calling vec3(p)
|
|
512
522
|
if (node.stage === 'vertex') {
|
|
513
|
-
if (doesLinkThruShader(graph, node)) {
|
|
514
|
-
returnGlPositionVec3Right(mainName, programAst);
|
|
523
|
+
if ((0, graph_2.doesLinkThruShader)(graph, node)) {
|
|
524
|
+
(0, ast_1.returnGlPositionVec3Right)(mainName, programAst);
|
|
515
525
|
}
|
|
516
526
|
else {
|
|
517
|
-
returnGlPosition(mainName, programAst);
|
|
527
|
+
(0, ast_1.returnGlPosition)(mainName, programAst);
|
|
518
528
|
}
|
|
519
529
|
}
|
|
520
530
|
return ast;
|
|
521
531
|
},
|
|
522
532
|
},
|
|
523
|
-
_b[EngineNodeType.phong] = {
|
|
533
|
+
_b[engine_1.EngineNodeType.phong] = {
|
|
524
534
|
onBeforeCompile: function (graph, engineContext, node, sibling) { return __awaiter(void 0, void 0, void 0, function () {
|
|
525
535
|
return __generator(this, function (_a) {
|
|
526
536
|
cacher(engineContext, graph, node, sibling, function () {
|
|
527
|
-
return onBeforeCompileMegaShader(engineContext, new MeshPhongMaterial(__assign({
|
|
537
|
+
return onBeforeCompileMegaShader(engineContext, new three_1.MeshPhongMaterial(__assign({
|
|
528
538
|
// @ts-ignore
|
|
529
539
|
isMeshPhongMaterial: true }, threeMaterialProperties(graph, node, sibling))));
|
|
530
540
|
});
|
|
@@ -533,22 +543,22 @@ export var threngine = {
|
|
|
533
543
|
}); },
|
|
534
544
|
manipulateAst: megaShaderMainpulateAst,
|
|
535
545
|
},
|
|
536
|
-
_b[EngineNodeType.physical] = {
|
|
546
|
+
_b[engine_1.EngineNodeType.physical] = {
|
|
537
547
|
onBeforeCompile: function (graph, engineContext, node, sibling) { return __awaiter(void 0, void 0, void 0, function () {
|
|
538
548
|
return __generator(this, function (_a) {
|
|
539
549
|
cacher(engineContext, graph, node, sibling, function () {
|
|
540
|
-
return onBeforeCompileMegaShader(engineContext, new MeshPhysicalMaterial(__assign(__assign({}, node.config.hardCodedProperties), threeMaterialProperties(graph, node, sibling))));
|
|
550
|
+
return onBeforeCompileMegaShader(engineContext, new three_1.MeshPhysicalMaterial(__assign(__assign({}, node.config.hardCodedProperties), threeMaterialProperties(graph, node, sibling))));
|
|
541
551
|
});
|
|
542
552
|
return [2 /*return*/];
|
|
543
553
|
});
|
|
544
554
|
}); },
|
|
545
555
|
manipulateAst: megaShaderMainpulateAst,
|
|
546
556
|
},
|
|
547
|
-
_b[EngineNodeType.toon] = {
|
|
557
|
+
_b[engine_1.EngineNodeType.toon] = {
|
|
548
558
|
onBeforeCompile: function (graph, engineContext, node, sibling) { return __awaiter(void 0, void 0, void 0, function () {
|
|
549
559
|
return __generator(this, function (_a) {
|
|
550
560
|
cacher(engineContext, graph, node, sibling, function () {
|
|
551
|
-
return onBeforeCompileMegaShader(engineContext, new MeshToonMaterial(__assign({ gradientMap: new Texture(),
|
|
561
|
+
return onBeforeCompileMegaShader(engineContext, new three_1.MeshToonMaterial(__assign({ gradientMap: new three_1.Texture(),
|
|
552
562
|
// @ts-ignore
|
|
553
563
|
isMeshToonMaterial: true }, threeMaterialProperties(graph, node, sibling))));
|
|
554
564
|
});
|
|
@@ -559,16 +569,16 @@ export var threngine = {
|
|
|
559
569
|
},
|
|
560
570
|
_b),
|
|
561
571
|
};
|
|
562
|
-
|
|
572
|
+
var createMaterial = function (compileResult, ctx) {
|
|
563
573
|
var engineMaterial = ctx.runtime.engineMaterial;
|
|
564
|
-
var finalUniforms = __assign(__assign(__assign(__assign({}, ShaderLib.phong.uniforms), ShaderLib.toon.uniforms), ShaderLib.physical.uniforms), { time: { value: 0 }, cameraPosition: { value: new Vector3(1.0) } });
|
|
574
|
+
var finalUniforms = __assign(__assign(__assign(__assign({}, three_1.ShaderLib.phong.uniforms), three_1.ShaderLib.toon.uniforms), three_1.ShaderLib.physical.uniforms), { time: { value: 0 }, cameraPosition: { value: new three_1.Vector3(1.0) } });
|
|
565
575
|
// Also the ThreeComponent's sceneConfig properties modify the material
|
|
566
576
|
var initialProperties = {
|
|
567
577
|
name: 'ShaderFrog Material',
|
|
568
578
|
lights: true,
|
|
569
579
|
uniforms: __assign({}, finalUniforms),
|
|
570
580
|
// See https://github.com/mrdoob/three.js/pull/26809
|
|
571
|
-
glslVersion: GLSL3,
|
|
581
|
+
glslVersion: three_1.GLSL3,
|
|
572
582
|
vertexShader: compileResult === null || compileResult === void 0 ? void 0 : compileResult.vertexResult.replace('#version 300 es', ''),
|
|
573
583
|
fragmentShader: compileResult === null || compileResult === void 0 ? void 0 : compileResult.fragmentResult.replace('#version 300 es', ''),
|
|
574
584
|
};
|
|
@@ -596,7 +606,7 @@ export var createMaterial = function (compileResult, ctx) {
|
|
|
596
606
|
var _c = __read(_a, 2), key = _c[0], value = _c[1];
|
|
597
607
|
return (__assign(__assign({}, acc), (_b = {}, _b[key] = value, _b)));
|
|
598
608
|
}, {});
|
|
599
|
-
var material = new RawShaderMaterial(initialProperties);
|
|
609
|
+
var material = new three_1.RawShaderMaterial(initialProperties);
|
|
600
610
|
// This prevents a deluge of warnings from three on the constructor saying
|
|
601
611
|
// that each of these properties is not a property of the material
|
|
602
612
|
Object.entries(additionalProperties).forEach(function (_a) {
|
|
@@ -606,3 +616,4 @@ export var createMaterial = function (compileResult, ctx) {
|
|
|
606
616
|
});
|
|
607
617
|
return material;
|
|
608
618
|
};
|
|
619
|
+
exports.createMaterial = createMaterial;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyAssignmentToStrategy = exports.assignemntToStrategy = void 0;
|
|
4
|
+
var ast_1 = require("../util/ast");
|
|
5
|
+
var base_node_1 = require("../graph/base-node");
|
|
6
|
+
var _1 = require(".");
|
|
7
|
+
// Constructor
|
|
8
|
+
var assignemntToStrategy = function (assignTo) { return ({
|
|
9
|
+
type: _1.StrategyType.ASSIGNMENT_TO,
|
|
10
|
+
config: { assignTo: assignTo },
|
|
11
|
+
}); };
|
|
12
|
+
exports.assignemntToStrategy = assignemntToStrategy;
|
|
13
|
+
// Apply the strategy
|
|
14
|
+
var applyAssignmentToStrategy = function (strategy, ast, graphNode, siblingNode) {
|
|
15
|
+
var assignNode = (0, ast_1.findAssignmentTo)(ast, strategy.config.assignTo);
|
|
16
|
+
var name = strategy.config.assignTo;
|
|
17
|
+
return assignNode
|
|
18
|
+
? [
|
|
19
|
+
[
|
|
20
|
+
(0, base_node_1.nodeInput)(name, "filler_".concat(name), 'filler', undefined, // Data type for what plugs into this filler
|
|
21
|
+
['code', 'data'], false),
|
|
22
|
+
function (fillerAst) {
|
|
23
|
+
assignNode.expression.right =
|
|
24
|
+
fillerAst;
|
|
25
|
+
return ast;
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
]
|
|
29
|
+
: [];
|
|
30
|
+
};
|
|
31
|
+
exports.applyAssignmentToStrategy = applyAssignmentToStrategy;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constApplyDeclarationOf = exports.declarationOfStrategy = void 0;
|
|
4
|
+
var ast_1 = require("../util/ast");
|
|
5
|
+
var base_node_1 = require("../graph/base-node");
|
|
6
|
+
var _1 = require(".");
|
|
7
|
+
var declarationOfStrategy = function (declarationOf) { return ({
|
|
8
|
+
type: _1.StrategyType.DECLARATION_OF,
|
|
9
|
+
config: { declarationOf: declarationOf },
|
|
10
|
+
}); };
|
|
11
|
+
exports.declarationOfStrategy = declarationOfStrategy;
|
|
12
|
+
var constApplyDeclarationOf = function (strategy, ast, graphNode, siblingNode) {
|
|
13
|
+
var declaration = (0, ast_1.findDeclarationOf)(ast, strategy.config.declarationOf);
|
|
14
|
+
var name = strategy.config.declarationOf;
|
|
15
|
+
return declaration
|
|
16
|
+
? [
|
|
17
|
+
[
|
|
18
|
+
(0, base_node_1.nodeInput)(name, "filler_".concat(name), 'filler', undefined, // Data type for what plugs into this filler
|
|
19
|
+
['code', 'data'], false),
|
|
20
|
+
function (fillerAst) {
|
|
21
|
+
declaration.initializer = fillerAst;
|
|
22
|
+
return ast;
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
]
|
|
26
|
+
: [];
|
|
27
|
+
};
|
|
28
|
+
exports.constApplyDeclarationOf = constApplyDeclarationOf;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyHardCodeStrategy = exports.hardCodeStrategy = void 0;
|
|
4
|
+
var _1 = require(".");
|
|
5
|
+
var hardCodeStrategy = function (inputs) { return ({
|
|
6
|
+
type: _1.StrategyType.HARD_CODE_INPUTS,
|
|
4
7
|
config: { inputs: inputs },
|
|
5
8
|
}); };
|
|
6
|
-
|
|
9
|
+
exports.hardCodeStrategy = hardCodeStrategy;
|
|
10
|
+
var applyHardCodeStrategy = function (strategy, ast, graphNode, siblingNode) {
|
|
7
11
|
return strategy.config.inputs.map(function (input) {
|
|
8
12
|
// Broken out into two lines to enforce type checking on the array.
|
|
9
13
|
var ci = [
|
|
@@ -21,3 +25,4 @@ export var applyHardCodeStrategy = function (strategy, ast, graphNode, siblingNo
|
|
|
21
25
|
return ci;
|
|
22
26
|
});
|
|
23
27
|
};
|
|
28
|
+
exports.applyHardCodeStrategy = applyHardCodeStrategy;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./hardCode"), exports);
|
|
18
|
+
__exportStar(require("./uniform"), exports);
|
|
19
|
+
__exportStar(require("./assignemntTo"), exports);
|
|
20
|
+
__exportStar(require("./inject"), exports);
|
|
21
|
+
__exportStar(require("./declarationOf"), exports);
|
|
22
|
+
__exportStar(require("./texture2D"), exports);
|
|
23
|
+
__exportStar(require("./namedAttribute"), exports);
|
|
24
|
+
__exportStar(require("./variable"), exports);
|
|
25
|
+
__exportStar(require("./strategy"), exports);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __assign = (this && this.__assign) || function () {
|
|
2
3
|
__assign = Object.assign || function(t) {
|
|
3
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -34,17 +35,20 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
34
35
|
}
|
|
35
36
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
37
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.applyInjectStrategy = exports.injectStrategy = void 0;
|
|
40
|
+
var glsl_parser_1 = require("@shaderfrog/glsl-parser");
|
|
41
|
+
var base_node_1 = require("../graph/base-node");
|
|
42
|
+
var _1 = require(".");
|
|
40
43
|
/**
|
|
41
44
|
* Inject source code into an AST, in a find-and-replace style. This only
|
|
42
45
|
* operates on statements right now
|
|
43
46
|
*/
|
|
44
|
-
|
|
45
|
-
type: StrategyType.INJECT,
|
|
47
|
+
var injectStrategy = function (config) { return ({
|
|
48
|
+
type: _1.StrategyType.INJECT,
|
|
46
49
|
config: config,
|
|
47
50
|
}); };
|
|
51
|
+
exports.injectStrategy = injectStrategy;
|
|
48
52
|
// Typescript fucked up flat https://stackoverflow.com/a/61420611/743464
|
|
49
53
|
var combineWs = function (a, b) {
|
|
50
54
|
return [a, b].flat(Infinity);
|
|
@@ -65,7 +69,7 @@ var transferWhitespace = function (to, from) {
|
|
|
65
69
|
]
|
|
66
70
|
: [to, from];
|
|
67
71
|
};
|
|
68
|
-
|
|
72
|
+
var applyInjectStrategy = function (strategy, ast, graphNode, siblingNode) {
|
|
69
73
|
var program = ast.program;
|
|
70
74
|
var _a = strategy.config, find = _a.find, count = _a.count, insert = _a.insert;
|
|
71
75
|
// Total hack for now. Search each function body for statements that when
|
|
@@ -75,7 +79,7 @@ export var applyInjectStrategy = function (strategy, ast, graphNode, siblingNode
|
|
|
75
79
|
if (statement.type === 'function') {
|
|
76
80
|
var bodyStatements_1 = statement.body.statements;
|
|
77
81
|
newMatches = bodyStatements_1.reduce(function (innerMatches, bodyStmt, index) {
|
|
78
|
-
var generated = generate(bodyStmt);
|
|
82
|
+
var generated = (0, glsl_parser_1.generate)(bodyStmt);
|
|
79
83
|
// console.log(`"${generated}"`);
|
|
80
84
|
var triple = [
|
|
81
85
|
bodyStatements_1,
|
|
@@ -90,7 +94,7 @@ export var applyInjectStrategy = function (strategy, ast, graphNode, siblingNode
|
|
|
90
94
|
var name = "Inject ".concat(strategy.config.insert);
|
|
91
95
|
return [
|
|
92
96
|
[
|
|
93
|
-
nodeInput(name, "filler_".concat(name), 'filler', undefined, // Data type for what plugs into this filler
|
|
97
|
+
(0, base_node_1.nodeInput)(name, "filler_".concat(name), 'filler', undefined, // Data type for what plugs into this filler
|
|
94
98
|
['code', 'data'], false),
|
|
95
99
|
function (fillerAst) {
|
|
96
100
|
var toInsert = Array.isArray(fillerAst)
|
|
@@ -120,3 +124,4 @@ export var applyInjectStrategy = function (strategy, ast, graphNode, siblingNode
|
|
|
120
124
|
],
|
|
121
125
|
];
|
|
122
126
|
};
|
|
127
|
+
exports.applyInjectStrategy = applyInjectStrategy;
|