@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.
Files changed (89) hide show
  1. package/{dist/engine.js → engine.js} +28 -19
  2. package/graph/base-node.js +13 -0
  3. package/{dist/graph → graph}/code-nodes.js +9 -4
  4. package/{dist/graph → graph}/context.js +39 -29
  5. package/{dist/graph → graph}/data-nodes.js +27 -12
  6. package/graph/edge.js +12 -0
  7. package/{dist/graph → graph}/evaluate.js +10 -5
  8. package/{dist/graph → graph}/graph-node.js +28 -20
  9. package/{dist/graph → graph}/graph-types.js +10 -7
  10. package/{dist/graph → graph}/graph.js +129 -102
  11. package/{dist/graph → graph}/graph.test.js +41 -36
  12. package/graph/index.js +27 -0
  13. package/{dist/graph → graph}/parsers.js +45 -39
  14. package/{dist/graph → graph}/shader-sections.js +36 -24
  15. package/index.js +19 -0
  16. package/package.json +10 -2
  17. package/{dist/plugins → plugins}/babylon/bablyengine.js +86 -78
  18. package/{dist/plugins → plugins}/babylon/importers.js +7 -5
  19. package/plugins/babylon/index.js +5 -0
  20. package/{dist/plugins → plugins}/playcanvas/importers.js +5 -3
  21. package/plugins/playcanvas/index.js +5 -0
  22. package/{dist/plugins → plugins}/playcanvas/playengine.js +96 -64
  23. package/{dist/plugins → plugins}/three/importers.js +5 -3
  24. package/plugins/three/index.js +6 -0
  25. package/{dist/plugins → plugins}/three/threngine.js +122 -111
  26. package/strategy/assignemntTo.js +31 -0
  27. package/strategy/declarationOf.js +28 -0
  28. package/{dist/strategy → strategy}/hardCode.js +9 -4
  29. package/strategy/index.js +25 -0
  30. package/{dist/strategy → strategy}/inject.js +13 -8
  31. package/{dist/strategy → strategy}/namedAttribute.js +13 -8
  32. package/strategy/strategy.js +35 -0
  33. package/{dist/strategy → strategy}/stratgies.test.js +59 -31
  34. package/{dist/strategy → strategy}/texture2D.js +15 -10
  35. package/{dist/strategy → strategy}/uniform.js +17 -12
  36. package/{dist/strategy → strategy}/variable.js +14 -9
  37. package/{dist/util → util}/ast.js +59 -40
  38. package/{dist/util → util}/ensure.js +5 -1
  39. package/util/id.js +6 -0
  40. package/dist/graph/base-node.js +0 -9
  41. package/dist/graph/edge.js +0 -7
  42. package/dist/graph/index.js +0 -11
  43. package/dist/index.js +0 -3
  44. package/dist/plugins/babylon/index.js +0 -2
  45. package/dist/plugins/playcanvas/index.js +0 -2
  46. package/dist/plugins/three/index.js +0 -2
  47. package/dist/strategy/assignemntTo.js +0 -26
  48. package/dist/strategy/declarationOf.js +0 -23
  49. package/dist/strategy/index.js +0 -9
  50. package/dist/strategy/strategy.js +0 -31
  51. package/dist/util/id.js +0 -2
  52. /package/{dist/engine.d.ts → engine.d.ts} +0 -0
  53. /package/{dist/graph → graph}/base-node.d.ts +0 -0
  54. /package/{dist/graph → graph}/code-nodes.d.ts +0 -0
  55. /package/{dist/graph → graph}/context.d.ts +0 -0
  56. /package/{dist/graph → graph}/data-nodes.d.ts +0 -0
  57. /package/{dist/graph → graph}/edge.d.ts +0 -0
  58. /package/{dist/graph → graph}/evaluate.d.ts +0 -0
  59. /package/{dist/graph → graph}/graph-node.d.ts +0 -0
  60. /package/{dist/graph → graph}/graph-types.d.ts +0 -0
  61. /package/{dist/graph → graph}/graph.d.ts +0 -0
  62. /package/{dist/graph → graph}/graph.test.d.ts +0 -0
  63. /package/{dist/graph → graph}/index.d.ts +0 -0
  64. /package/{dist/graph → graph}/parsers.d.ts +0 -0
  65. /package/{dist/graph → graph}/shader-sections.d.ts +0 -0
  66. /package/{dist/index.d.ts → index.d.ts} +0 -0
  67. /package/{dist/plugins → plugins}/babylon/bablyengine.d.ts +0 -0
  68. /package/{dist/plugins → plugins}/babylon/importers.d.ts +0 -0
  69. /package/{dist/plugins → plugins}/babylon/index.d.ts +0 -0
  70. /package/{dist/plugins → plugins}/playcanvas/importers.d.ts +0 -0
  71. /package/{dist/plugins → plugins}/playcanvas/index.d.ts +0 -0
  72. /package/{dist/plugins → plugins}/playcanvas/playengine.d.ts +0 -0
  73. /package/{dist/plugins → plugins}/three/importers.d.ts +0 -0
  74. /package/{dist/plugins → plugins}/three/index.d.ts +0 -0
  75. /package/{dist/plugins → plugins}/three/threngine.d.ts +0 -0
  76. /package/{dist/strategy → strategy}/assignemntTo.d.ts +0 -0
  77. /package/{dist/strategy → strategy}/declarationOf.d.ts +0 -0
  78. /package/{dist/strategy → strategy}/hardCode.d.ts +0 -0
  79. /package/{dist/strategy → strategy}/index.d.ts +0 -0
  80. /package/{dist/strategy → strategy}/inject.d.ts +0 -0
  81. /package/{dist/strategy → strategy}/namedAttribute.d.ts +0 -0
  82. /package/{dist/strategy → strategy}/strategy.d.ts +0 -0
  83. /package/{dist/strategy → strategy}/stratgies.test.d.ts +0 -0
  84. /package/{dist/strategy → strategy}/texture2D.d.ts +0 -0
  85. /package/{dist/strategy → strategy}/uniform.d.ts +0 -0
  86. /package/{dist/strategy → strategy}/variable.d.ts +0 -0
  87. /package/{dist/util → util}/ast.d.ts +0 -0
  88. /package/{dist/util → util}/ensure.d.ts +0 -0
  89. /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,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
- import { PBRMaterial, Texture, Light, Vector2, Vector3, Vector4, Color3, Color4, } from 'babylonjs';
75
- import { EngineNodeType } from '../../engine';
76
- import { nodeName, doesLinkThruShader, prepopulatePropertyInputs, mangleMainFn, } from '../../graph/graph';
77
- import { NodeType } from '../../graph/graph-types';
78
- import importers from './importers';
79
- import { returnGlPositionHardCoded, returnGlPosition, returnGlPositionVec3Right, } from '../../util/ast';
80
- import { property, } from '../../graph/code-nodes';
81
- import { namedAttributeStrategy, texture2DStrategy, uniformStrategy, } from '../../strategy';
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
- export var physicalDefaultProperties = {
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
- export var physicalNode = function (id, name, position, uniforms, stage) {
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
- export var toonNode = function (id, name, position, uniforms, stage) {
155
- return prepopulatePropertyInputs({
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
- export var mIdx = 0;
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
- export var babylengine = {
445
+ exports.babylengine = {
438
446
  name: 'babylon',
439
447
  displayName: 'Babylon.js',
440
- importers: 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
- import { renameBindings } from '@shaderfrog/glsl-parser/parser/utils';
3
- import { EngineNodeType } from '../../engine';
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
- export default importers;
66
+ exports.default = importers;
@@ -0,0 +1,5 @@
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
- import { EngineNodeType } from '../../engine';
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
- export default importers;
30
+ exports.default = importers;
@@ -0,0 +1,5 @@
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; } });