@shaderfrog/core 1.1.1 → 1.2.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/engine.js +28 -19
- package/graph/base-node.js +5 -1
- package/graph/code-nodes.js +9 -4
- package/graph/context.js +39 -29
- package/graph/data-nodes.js +27 -12
- package/graph/edge.js +11 -6
- package/graph/evaluate.js +10 -5
- package/graph/graph-node.js +28 -20
- package/graph/graph-types.js +10 -7
- package/graph/graph.js +129 -102
- package/graph/graph.test.js +41 -36
- package/graph/index.js +27 -11
- package/graph/parsers.js +45 -39
- package/graph/shader-sections.js +36 -24
- package/index.js +19 -3
- package/package.json +1 -1
- package/plugins/babylon/bablyengine.js +86 -78
- package/plugins/babylon/importers.js +7 -5
- package/plugins/babylon/index.js +5 -2
- package/plugins/playcanvas/importers.js +5 -3
- package/plugins/playcanvas/index.js +5 -2
- package/plugins/playcanvas/playengine.js +96 -64
- package/plugins/three/importers.js +5 -3
- package/plugins/three/index.js +6 -2
- package/plugins/three/threngine.js +122 -111
- package/strategy/assignemntTo.js +13 -8
- package/strategy/declarationOf.js +13 -8
- package/strategy/hardCode.js +9 -4
- package/strategy/index.js +25 -9
- package/strategy/inject.js +13 -8
- package/strategy/namedAttribute.js +13 -8
- package/strategy/strategy.js +23 -19
- package/strategy/stratgies.test.js +59 -31
- package/strategy/texture2D.js +15 -10
- package/strategy/uniform.js +17 -12
- package/strategy/variable.js +14 -9
- package/util/ast.js +59 -40
- package/util/ensure.js +5 -1
- package/util/id.js +5 -1
|
@@ -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,23 +71,28 @@ 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
|
-
|
|
78
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
|
+
exports.babylengine = exports.mIdx = exports.toonNode = exports.physicalNode = exports.physicalDefaultProperties = void 0;
|
|
80
|
+
var babylonjs_1 = require("babylonjs");
|
|
81
|
+
var engine_1 = require("../../engine");
|
|
82
|
+
var graph_1 = require("../../graph/graph");
|
|
83
|
+
var graph_types_1 = require("../../graph/graph-types");
|
|
84
|
+
var importers_1 = __importDefault(require("./importers"));
|
|
85
|
+
var ast_1 = require("../../util/ast");
|
|
86
|
+
var code_nodes_1 = require("../../graph/code-nodes");
|
|
87
|
+
var strategy_1 = require("../../strategy");
|
|
82
88
|
// Setting these properties on the material have side effects, not just for the
|
|
83
89
|
// GLSL, but for the material itself in JS memory apparently, maybe the bound
|
|
84
90
|
// uniforms?. The material we create in babylengine must have the same initial
|
|
85
91
|
// properties as those in BabylonComponent or else there will be errors with
|
|
86
92
|
// uniforms
|
|
87
|
-
|
|
93
|
+
exports.physicalDefaultProperties = {
|
|
88
94
|
forceIrradianceInFragment: true,
|
|
89
|
-
albedoColor: new Color3(1.0, 1.0, 1.0),
|
|
95
|
+
albedoColor: new babylonjs_1.Color3(1.0, 1.0, 1.0),
|
|
90
96
|
metallic: 0.0,
|
|
91
97
|
roughness: 1.0,
|
|
92
98
|
};
|
|
@@ -99,43 +105,43 @@ var log = function () {
|
|
|
99
105
|
return (_a = console.log).call.apply(_a, __spreadArray([console, '\x1b[33m(babylengine)\x1b[0m'], __read(args), false));
|
|
100
106
|
};
|
|
101
107
|
var babylonHackCache = {};
|
|
102
|
-
|
|
103
|
-
return prepopulatePropertyInputs({
|
|
108
|
+
var physicalNode = function (id, name, position, uniforms, stage) {
|
|
109
|
+
return (0, graph_1.prepopulatePropertyInputs)({
|
|
104
110
|
id: id,
|
|
105
111
|
name: 'PBRMaterial',
|
|
106
112
|
position: position,
|
|
107
113
|
engine: true,
|
|
108
|
-
type: EngineNodeType.physical,
|
|
114
|
+
type: engine_1.EngineNodeType.physical,
|
|
109
115
|
config: {
|
|
110
116
|
uniforms: uniforms,
|
|
111
117
|
version: 3,
|
|
112
118
|
mangle: false,
|
|
113
119
|
preprocess: true,
|
|
114
120
|
properties: [
|
|
115
|
-
property('Base Color', 'baseColor', 'rgb', '?????'),
|
|
116
|
-
property('Color', 'albedoColor', 'rgb', 'uniform_vAlbedoColor'),
|
|
117
|
-
property('Texture', 'albedoTexture', 'texture', 'filler_albedoSampler'),
|
|
118
|
-
property('Bump Map', 'bumpTexture', 'texture', 'filler_bumpSampler'),
|
|
119
|
-
property('Metalness', 'metallic', 'number'),
|
|
120
|
-
property('Roughness', 'roughness', 'number'),
|
|
121
|
-
property('Env Map', 'environmentTexture', 'samplerCube'),
|
|
122
|
-
property('Reflection Texture', 'reflectionTexture', 'samplerCube'),
|
|
123
|
-
property('Refraction Texture', 'refractionTexture', 'samplerCube'),
|
|
124
|
-
property('Index Of Refraction', 'indexOfRefraction', 'number'),
|
|
125
|
-
property('Alpha', 'alpha', 'number'),
|
|
126
|
-
property('Direct Intensity', 'directIntensity', 'number'),
|
|
127
|
-
property('Environment Intensity', 'environmentIntensity', 'number'),
|
|
128
|
-
property('Camera Exposure', 'cameraExposure', 'number'),
|
|
129
|
-
property('Camera Contrast', 'cameraContrast', 'number'),
|
|
130
|
-
property('Micro Surface', 'microSurface', 'number'),
|
|
131
|
-
property('Reflectivity Color', 'reflectivityColor', 'rgb'),
|
|
121
|
+
(0, code_nodes_1.property)('Base Color', 'baseColor', 'rgb', '?????'),
|
|
122
|
+
(0, code_nodes_1.property)('Color', 'albedoColor', 'rgb', 'uniform_vAlbedoColor'),
|
|
123
|
+
(0, code_nodes_1.property)('Texture', 'albedoTexture', 'texture', 'filler_albedoSampler'),
|
|
124
|
+
(0, code_nodes_1.property)('Bump Map', 'bumpTexture', 'texture', 'filler_bumpSampler'),
|
|
125
|
+
(0, code_nodes_1.property)('Metalness', 'metallic', 'number'),
|
|
126
|
+
(0, code_nodes_1.property)('Roughness', 'roughness', 'number'),
|
|
127
|
+
(0, code_nodes_1.property)('Env Map', 'environmentTexture', 'samplerCube'),
|
|
128
|
+
(0, code_nodes_1.property)('Reflection Texture', 'reflectionTexture', 'samplerCube'),
|
|
129
|
+
(0, code_nodes_1.property)('Refraction Texture', 'refractionTexture', 'samplerCube'),
|
|
130
|
+
(0, code_nodes_1.property)('Index Of Refraction', 'indexOfRefraction', 'number'),
|
|
131
|
+
(0, code_nodes_1.property)('Alpha', 'alpha', 'number'),
|
|
132
|
+
(0, code_nodes_1.property)('Direct Intensity', 'directIntensity', 'number'),
|
|
133
|
+
(0, code_nodes_1.property)('Environment Intensity', 'environmentIntensity', 'number'),
|
|
134
|
+
(0, code_nodes_1.property)('Camera Exposure', 'cameraExposure', 'number'),
|
|
135
|
+
(0, code_nodes_1.property)('Camera Contrast', 'cameraContrast', 'number'),
|
|
136
|
+
(0, code_nodes_1.property)('Micro Surface', 'microSurface', 'number'),
|
|
137
|
+
(0, code_nodes_1.property)('Reflectivity Color', 'reflectivityColor', 'rgb'),
|
|
132
138
|
],
|
|
133
|
-
hardCodedProperties: physicalDefaultProperties,
|
|
139
|
+
hardCodedProperties: exports.physicalDefaultProperties,
|
|
134
140
|
strategies: [
|
|
135
|
-
uniformStrategy(),
|
|
141
|
+
(0, strategy_1.uniformStrategy)(),
|
|
136
142
|
stage === 'fragment'
|
|
137
|
-
? texture2DStrategy()
|
|
138
|
-
: namedAttributeStrategy('position'),
|
|
143
|
+
? (0, strategy_1.texture2DStrategy)()
|
|
144
|
+
: (0, strategy_1.namedAttributeStrategy)('position'),
|
|
139
145
|
],
|
|
140
146
|
},
|
|
141
147
|
inputs: [],
|
|
@@ -151,32 +157,33 @@ export var physicalNode = function (id, name, position, uniforms, stage) {
|
|
|
151
157
|
stage: stage,
|
|
152
158
|
});
|
|
153
159
|
};
|
|
154
|
-
|
|
155
|
-
|
|
160
|
+
exports.physicalNode = physicalNode;
|
|
161
|
+
var toonNode = function (id, name, position, uniforms, stage) {
|
|
162
|
+
return (0, graph_1.prepopulatePropertyInputs)({
|
|
156
163
|
id: id,
|
|
157
164
|
name: name,
|
|
158
165
|
position: position,
|
|
159
166
|
engine: true,
|
|
160
|
-
type: EngineNodeType.toon,
|
|
167
|
+
type: engine_1.EngineNodeType.toon,
|
|
161
168
|
config: {
|
|
162
169
|
uniforms: uniforms,
|
|
163
170
|
version: 3,
|
|
164
171
|
preprocess: true,
|
|
165
172
|
mangle: false,
|
|
166
173
|
properties: [
|
|
167
|
-
property('Color', 'color', 'rgb', 'uniform_diffuse'),
|
|
168
|
-
property('Texture', 'map', 'texture', 'filler_map'),
|
|
169
|
-
property('Gradient Map', 'gradientMap', 'texture', 'filler_gradientMap'),
|
|
170
|
-
property('Normal Map', 'normalMap', 'texture', 'filler_normalMap'),
|
|
171
|
-
property('Normal Scale', 'normalScale', 'vector2'),
|
|
172
|
-
property('Displacement Map', 'displacementMap', 'texture'),
|
|
173
|
-
property('Env Map', 'envMap', 'samplerCube'),
|
|
174
|
+
(0, code_nodes_1.property)('Color', 'color', 'rgb', 'uniform_diffuse'),
|
|
175
|
+
(0, code_nodes_1.property)('Texture', 'map', 'texture', 'filler_map'),
|
|
176
|
+
(0, code_nodes_1.property)('Gradient Map', 'gradientMap', 'texture', 'filler_gradientMap'),
|
|
177
|
+
(0, code_nodes_1.property)('Normal Map', 'normalMap', 'texture', 'filler_normalMap'),
|
|
178
|
+
(0, code_nodes_1.property)('Normal Scale', 'normalScale', 'vector2'),
|
|
179
|
+
(0, code_nodes_1.property)('Displacement Map', 'displacementMap', 'texture'),
|
|
180
|
+
(0, code_nodes_1.property)('Env Map', 'envMap', 'samplerCube'),
|
|
174
181
|
],
|
|
175
182
|
strategies: [
|
|
176
|
-
uniformStrategy(),
|
|
183
|
+
(0, strategy_1.uniformStrategy)(),
|
|
177
184
|
stage === 'fragment'
|
|
178
|
-
? texture2DStrategy()
|
|
179
|
-
: namedAttributeStrategy('position'),
|
|
185
|
+
? (0, strategy_1.texture2DStrategy)()
|
|
186
|
+
: (0, strategy_1.namedAttributeStrategy)('position'),
|
|
180
187
|
],
|
|
181
188
|
},
|
|
182
189
|
inputs: [],
|
|
@@ -192,6 +199,7 @@ export var toonNode = function (id, name, position, uniforms, stage) {
|
|
|
192
199
|
stage: stage,
|
|
193
200
|
});
|
|
194
201
|
};
|
|
202
|
+
exports.toonNode = toonNode;
|
|
195
203
|
var babylonMaterialProperties = function (scene, graph, node, sibling) {
|
|
196
204
|
// Find inputs to this node that are dependent on a property of the material
|
|
197
205
|
var propertyInputs = node.inputs
|
|
@@ -211,24 +219,24 @@ var babylonMaterialProperties = function (scene, graph, node, sibling) {
|
|
|
211
219
|
var property_1 = (node.config.properties || []).find(function (p) { return p.property === propertyInput.property; });
|
|
212
220
|
// Initialize the property on the material
|
|
213
221
|
if (property_1.type === 'texture') {
|
|
214
|
-
acc[property_1.property] = new Texture('', scene);
|
|
222
|
+
acc[property_1.property] = new babylonjs_1.Texture('', scene);
|
|
215
223
|
}
|
|
216
224
|
else if (property_1.type === 'number') {
|
|
217
225
|
acc[property_1.property] = 0.5;
|
|
218
226
|
}
|
|
219
227
|
else if (property_1.type === 'rgb') {
|
|
220
|
-
acc[property_1.property] = new Color3(1, 1, 1);
|
|
228
|
+
acc[property_1.property] = new babylonjs_1.Color3(1, 1, 1);
|
|
221
229
|
}
|
|
222
230
|
else if (property_1.type === 'rgba') {
|
|
223
|
-
acc[property_1.property] = new Color4(1, 1, 1, 1);
|
|
231
|
+
acc[property_1.property] = new babylonjs_1.Color4(1, 1, 1, 1);
|
|
224
232
|
}
|
|
225
233
|
}
|
|
226
234
|
return acc;
|
|
227
235
|
}, {});
|
|
228
236
|
return props;
|
|
229
237
|
};
|
|
230
|
-
|
|
231
|
-
var id = function () { return mIdx++; };
|
|
238
|
+
exports.mIdx = 0;
|
|
239
|
+
var id = function () { return exports.mIdx++; };
|
|
232
240
|
var nodeCacheKey = function (graph, node) {
|
|
233
241
|
return ('[ID:' +
|
|
234
242
|
node.id +
|
|
@@ -249,7 +257,7 @@ var programCacheKey = function (engineContext, graph, node, sibling) {
|
|
|
249
257
|
// and type of lights in the scene. This kinda sucks - it's duplicating
|
|
250
258
|
// three's material cache key, and is coupled to how three builds shaders
|
|
251
259
|
var scene = engineContext.runtime.scene;
|
|
252
|
-
var lights = scene.getNodes().filter(function (n) { return n instanceof Light; });
|
|
260
|
+
var lights = scene.getNodes().filter(function (n) { return n instanceof babylonjs_1.Light; });
|
|
253
261
|
return ([node, sibling]
|
|
254
262
|
.filter(function (n) { return !!n; })
|
|
255
263
|
.sort(function (a, b) { return a.id.localeCompare(b.id); })
|
|
@@ -298,7 +306,7 @@ var onBeforeCompileMegaShader = function (engineContext, graph, node, sibling) {
|
|
|
298
306
|
return __generator(this, function (_c) {
|
|
299
307
|
_a = engineContext.runtime, scene = _a.scene, sceneData = _a.sceneData;
|
|
300
308
|
pbrName = "engine_pbr".concat(id());
|
|
301
|
-
shaderMaterial = new PBRMaterial(pbrName, scene);
|
|
309
|
+
shaderMaterial = new babylonjs_1.PBRMaterial(pbrName, scene);
|
|
302
310
|
shaderMaterial.linkRefractionWithTransparency = true;
|
|
303
311
|
shaderMaterial.subSurface.isRefractionEnabled = true;
|
|
304
312
|
newProperties = __assign(__assign({}, (node.config.hardCodedProperties ||
|
|
@@ -397,18 +405,18 @@ var onBeforeCompileMegaShader = function (engineContext, graph, node, sibling) {
|
|
|
397
405
|
// TODO: NEED TO DO SAME THREE MANGLIGN STEP HERE
|
|
398
406
|
var megaShaderMainpulateAst = function (engineContext, engine, graph, ast, inputEdges, node, sibling) {
|
|
399
407
|
var programAst = ast;
|
|
400
|
-
var mainName = 'main' || nodeName(node);
|
|
408
|
+
var mainName = 'main' || (0, graph_1.nodeName)(node);
|
|
401
409
|
if (node.stage === 'vertex') {
|
|
402
|
-
if (doesLinkThruShader(graph, node)) {
|
|
403
|
-
returnGlPositionHardCoded(mainName, programAst, 'vec3', 'transformed');
|
|
410
|
+
if ((0, graph_1.doesLinkThruShader)(graph, node)) {
|
|
411
|
+
(0, ast_1.returnGlPositionHardCoded)(mainName, programAst, 'vec3', 'transformed');
|
|
404
412
|
}
|
|
405
413
|
else {
|
|
406
|
-
returnGlPosition(mainName, programAst);
|
|
414
|
+
(0, ast_1.returnGlPosition)(mainName, programAst);
|
|
407
415
|
}
|
|
408
416
|
}
|
|
409
417
|
// We specify engine nodes are mangle: false, which is the graph step that
|
|
410
418
|
// handles renaming the main fn, so we have to do it ourselves
|
|
411
|
-
mangleMainFn(programAst, node, sibling);
|
|
419
|
+
(0, graph_1.mangleMainFn)(programAst, node, sibling);
|
|
412
420
|
return programAst;
|
|
413
421
|
};
|
|
414
422
|
var evaluateNode = function (node) {
|
|
@@ -416,36 +424,36 @@ var evaluateNode = function (node) {
|
|
|
416
424
|
return parseFloat(node.value);
|
|
417
425
|
}
|
|
418
426
|
if (node.type === 'vector2') {
|
|
419
|
-
return new Vector2(parseFloat(node.value[0]), parseFloat(node.value[1]));
|
|
427
|
+
return new babylonjs_1.Vector2(parseFloat(node.value[0]), parseFloat(node.value[1]));
|
|
420
428
|
}
|
|
421
429
|
else if (node.type === 'vector3') {
|
|
422
|
-
return new Vector3(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]));
|
|
430
|
+
return new babylonjs_1.Vector3(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]));
|
|
423
431
|
}
|
|
424
432
|
else if (node.type === 'vector4') {
|
|
425
|
-
return new Vector4(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]), parseFloat(node.value[3]));
|
|
433
|
+
return new babylonjs_1.Vector4(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]), parseFloat(node.value[3]));
|
|
426
434
|
}
|
|
427
435
|
else if (node.type === 'rgb') {
|
|
428
|
-
return new Color3(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]));
|
|
436
|
+
return new babylonjs_1.Color3(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]));
|
|
429
437
|
}
|
|
430
438
|
else if (node.type === 'rgba') {
|
|
431
|
-
return new Color4(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]), parseFloat(node.value[3]));
|
|
439
|
+
return new babylonjs_1.Color4(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]), parseFloat(node.value[3]));
|
|
432
440
|
}
|
|
433
441
|
else {
|
|
434
442
|
return node.value;
|
|
435
443
|
}
|
|
436
444
|
};
|
|
437
|
-
|
|
445
|
+
exports.babylengine = {
|
|
438
446
|
name: 'babylon',
|
|
439
447
|
displayName: 'Babylon.js',
|
|
440
|
-
importers:
|
|
448
|
+
importers: importers_1.default,
|
|
441
449
|
mergeOptions: {
|
|
442
450
|
includePrecisions: true,
|
|
443
451
|
includeVersion: false,
|
|
444
452
|
},
|
|
445
453
|
evaluateNode: evaluateNode,
|
|
446
454
|
constructors: (_a = {},
|
|
447
|
-
_a[EngineNodeType.physical] = physicalNode,
|
|
448
|
-
_a[EngineNodeType.toon] = toonNode,
|
|
455
|
+
_a[engine_1.EngineNodeType.physical] = exports.physicalNode,
|
|
456
|
+
_a[engine_1.EngineNodeType.toon] = exports.toonNode,
|
|
449
457
|
_a),
|
|
450
458
|
// TODO: Get from uniform lib?
|
|
451
459
|
preserve: new Set([
|
|
@@ -557,23 +565,23 @@ export var babylengine = {
|
|
|
557
565
|
'reflectionSampler',
|
|
558
566
|
]),
|
|
559
567
|
parsers: (_b = {},
|
|
560
|
-
_b[NodeType.SOURCE] = {
|
|
568
|
+
_b[graph_types_1.NodeType.SOURCE] = {
|
|
561
569
|
manipulateAst: function (engineContext, engine, graph, ast, inputEdges, node, sibling) {
|
|
562
570
|
var programAst = ast;
|
|
563
|
-
var mainName = 'main' || nodeName(node);
|
|
571
|
+
var mainName = 'main' || (0, graph_1.nodeName)(node);
|
|
564
572
|
// This hinges on the vertex shader calling vec3(p)
|
|
565
573
|
if (node.stage === 'vertex') {
|
|
566
|
-
if (doesLinkThruShader(graph, node)) {
|
|
567
|
-
returnGlPositionVec3Right(mainName, programAst);
|
|
574
|
+
if ((0, graph_1.doesLinkThruShader)(graph, node)) {
|
|
575
|
+
(0, ast_1.returnGlPositionVec3Right)(mainName, programAst);
|
|
568
576
|
}
|
|
569
577
|
else {
|
|
570
|
-
returnGlPosition(mainName, programAst);
|
|
578
|
+
(0, ast_1.returnGlPosition)(mainName, programAst);
|
|
571
579
|
}
|
|
572
580
|
}
|
|
573
581
|
return ast;
|
|
574
582
|
},
|
|
575
583
|
},
|
|
576
|
-
_b[EngineNodeType.physical] = {
|
|
584
|
+
_b[engine_1.EngineNodeType.physical] = {
|
|
577
585
|
onBeforeCompile: function (graph, engineContext, node, sibling) {
|
|
578
586
|
return cacher(engineContext, graph, node, sibling, function () {
|
|
579
587
|
return onBeforeCompileMegaShader(engineContext, graph, node, sibling);
|
|
@@ -583,7 +591,7 @@ export var babylengine = {
|
|
|
583
591
|
},
|
|
584
592
|
_b),
|
|
585
593
|
};
|
|
586
|
-
babylengine.parsers[EngineNodeType.toon] =
|
|
587
|
-
babylengine.parsers[EngineNodeType.physical];
|
|
588
|
-
babylengine.parsers[EngineNodeType.phong] =
|
|
589
|
-
babylengine.parsers[EngineNodeType.physical];
|
|
594
|
+
exports.babylengine.parsers[engine_1.EngineNodeType.toon] =
|
|
595
|
+
exports.babylengine.parsers[engine_1.EngineNodeType.physical];
|
|
596
|
+
exports.babylengine.parsers[engine_1.EngineNodeType.phong] =
|
|
597
|
+
exports.babylengine.parsers[engine_1.EngineNodeType.physical];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var _a;
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
var utils_1 = require("@shaderfrog/glsl-parser/parser/utils");
|
|
5
|
+
var engine_1 = require("../../engine");
|
|
4
6
|
var nodeInputMap = {
|
|
5
7
|
normalMap: 'bumpSampler',
|
|
6
8
|
property_map: 'property_albedoTexture',
|
|
@@ -22,7 +24,7 @@ var importers = {
|
|
|
22
24
|
// Babylon has no normalmatrix. They do have a normal attribute. So undo any
|
|
23
25
|
// multiplication by normalMatrix?
|
|
24
26
|
var seen = {};
|
|
25
|
-
renameBindings(ast.scopes[0], function (name) {
|
|
27
|
+
(0, utils_1.renameBindings)(ast.scopes[0], function (name) {
|
|
26
28
|
// console.log({ name }, 'seen:', seen[name]);
|
|
27
29
|
var renamed = name === 'vUv'
|
|
28
30
|
? 'vMainUV1'
|
|
@@ -50,7 +52,7 @@ var importers = {
|
|
|
50
52
|
});
|
|
51
53
|
},
|
|
52
54
|
nodeInputMap: (_a = {},
|
|
53
|
-
_a[EngineNodeType.physical] = nodeInputMap,
|
|
55
|
+
_a[engine_1.EngineNodeType.physical] = nodeInputMap,
|
|
54
56
|
_a),
|
|
55
57
|
edgeMap: {
|
|
56
58
|
normalMap: 'bumpSampler',
|
|
@@ -61,4 +63,4 @@ var importers = {
|
|
|
61
63
|
},
|
|
62
64
|
},
|
|
63
65
|
};
|
|
64
|
-
|
|
66
|
+
exports.default = importers;
|
package/plugins/babylon/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.engine = void 0;
|
|
4
|
+
var bablyengine_1 = require("./bablyengine");
|
|
5
|
+
Object.defineProperty(exports, "engine", { enumerable: true, get: function () { return bablyengine_1.babylengine; } });
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var _a;
|
|
2
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
var engine_1 = require("../../engine");
|
|
3
5
|
var nodeInputMap = {
|
|
4
6
|
normalMap: 'bumpSampler',
|
|
5
7
|
property_map: 'property_albedoTexture',
|
|
@@ -14,7 +16,7 @@ var importers = {
|
|
|
14
16
|
throw new Error('Not implemented');
|
|
15
17
|
},
|
|
16
18
|
nodeInputMap: (_a = {},
|
|
17
|
-
_a[EngineNodeType.physical] = nodeInputMap,
|
|
19
|
+
_a[engine_1.EngineNodeType.physical] = nodeInputMap,
|
|
18
20
|
_a),
|
|
19
21
|
edgeMap: {
|
|
20
22
|
normalMap: 'bumpSampler',
|
|
@@ -25,4 +27,4 @@ var importers = {
|
|
|
25
27
|
},
|
|
26
28
|
},
|
|
27
29
|
};
|
|
28
|
-
|
|
30
|
+
exports.default = importers;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.engine = void 0;
|
|
4
|
+
var playengine_1 = require("./playengine");
|
|
5
|
+
Object.defineProperty(exports, "engine", { enumerable: true, get: function () { return playengine_1.playengine; } });
|