@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++) {
|
|
@@ -9,6 +10,29 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
10
|
};
|
|
10
11
|
return __assign.apply(this, arguments);
|
|
11
12
|
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
12
36
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
37
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
38
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -70,15 +94,20 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
70
94
|
}
|
|
71
95
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
72
96
|
};
|
|
97
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
98
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
99
|
+
};
|
|
73
100
|
var _a, _b;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
101
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
102
|
+
exports.playengine = exports.mIdx = exports.toonNode = exports.physicalNode = exports.defaultPropertySetting = exports.physicalDefaultProperties = void 0;
|
|
103
|
+
var pc = __importStar(require("playcanvas"));
|
|
104
|
+
var engine_1 = require("../../engine");
|
|
105
|
+
var graph_1 = require("../../graph/graph");
|
|
106
|
+
var graph_types_1 = require("../../graph/graph-types");
|
|
107
|
+
var importers_1 = __importDefault(require("./importers"));
|
|
108
|
+
var ast_1 = require("../../util/ast");
|
|
109
|
+
var code_nodes_1 = require("../../graph/code-nodes");
|
|
110
|
+
var strategy_1 = require("../../strategy");
|
|
82
111
|
var log = function () {
|
|
83
112
|
var _a;
|
|
84
113
|
var args = [];
|
|
@@ -87,7 +116,7 @@ var log = function () {
|
|
|
87
116
|
}
|
|
88
117
|
return (_a = console.log).call.apply(_a, __spreadArray([console, '\x1b[33m(playengine)\x1b[0m'], __read(args), false));
|
|
89
118
|
};
|
|
90
|
-
|
|
119
|
+
exports.physicalDefaultProperties = {
|
|
91
120
|
// Required for objects with opacity
|
|
92
121
|
blendType: pc.BLEND_NORMAL,
|
|
93
122
|
// Hack (for now?). Playcanvas optimizes their materials to not calculate in
|
|
@@ -110,7 +139,7 @@ export var physicalDefaultProperties = {
|
|
|
110
139
|
* generation where if you set diffuse to white (1,1,1) then it doesn't
|
|
111
140
|
* add the diffuse uniform, because that's the default state.
|
|
112
141
|
*/
|
|
113
|
-
|
|
142
|
+
var defaultPropertySetting = function (app, property) {
|
|
114
143
|
if (property.type === 'texture') {
|
|
115
144
|
return new pc.Texture(app.graphicsDevice);
|
|
116
145
|
}
|
|
@@ -124,6 +153,7 @@ export var defaultPropertySetting = function (app, property) {
|
|
|
124
153
|
return new pc.Color(0.5, 0.5, 0.5, 0.5);
|
|
125
154
|
}
|
|
126
155
|
};
|
|
156
|
+
exports.defaultPropertySetting = defaultPropertySetting;
|
|
127
157
|
var applyPlayMaterialProperties = function (engineContext, shaderMaterial, app, graph, node, sibling) {
|
|
128
158
|
// Find inputs to this node that are dependent on a property of the material
|
|
129
159
|
var propertyInputs = node.inputs
|
|
@@ -152,7 +182,7 @@ var applyPlayMaterialProperties = function (engineContext, shaderMaterial, app,
|
|
|
152
182
|
* This code will probably error on some properties because I don't know
|
|
153
183
|
* if all "rgb" properties have to be set in this painful way.
|
|
154
184
|
*/
|
|
155
|
-
acc[property_1.property] = defaultPropertySetting(app, property_1);
|
|
185
|
+
acc[property_1.property] = (0, exports.defaultPropertySetting)(app, property_1);
|
|
156
186
|
// @ts-ignore
|
|
157
187
|
shaderMaterial[property_1.property] = acc[property_1.property];
|
|
158
188
|
}
|
|
@@ -160,35 +190,35 @@ var applyPlayMaterialProperties = function (engineContext, shaderMaterial, app,
|
|
|
160
190
|
}, {});
|
|
161
191
|
return props;
|
|
162
192
|
};
|
|
163
|
-
|
|
164
|
-
return prepopulatePropertyInputs({
|
|
193
|
+
var physicalNode = function (id, name, position, uniforms, stage) {
|
|
194
|
+
return (0, graph_1.prepopulatePropertyInputs)({
|
|
165
195
|
id: id,
|
|
166
196
|
name: 'StandardMaterial',
|
|
167
197
|
position: position,
|
|
168
198
|
engine: true,
|
|
169
|
-
type: EngineNodeType.physical,
|
|
199
|
+
type: engine_1.EngineNodeType.physical,
|
|
170
200
|
config: {
|
|
171
201
|
uniforms: uniforms,
|
|
172
202
|
version: 3,
|
|
173
203
|
mangle: false,
|
|
174
204
|
preprocess: true,
|
|
175
205
|
properties: [
|
|
176
|
-
property('Color', 'diffuse', 'rgb'),
|
|
206
|
+
(0, code_nodes_1.property)('Color', 'diffuse', 'rgb'),
|
|
177
207
|
// Object is black while using these
|
|
178
208
|
// property('Emissive', 'emissive', 'rgb'),
|
|
179
209
|
// property('Emissive Intensity', 'emissiveIntensity', 'number'),
|
|
180
210
|
// property('Emissive Map', 'emissiveMap', 'texture'),
|
|
181
|
-
property('Diffuse Map', 'diffuseMap', 'texture', 'filler_texture_diffuseMap'),
|
|
182
|
-
property('Normal Map', 'normalMap', 'texture', 'filler_texture_normalMap'),
|
|
183
|
-
property('Bumpiness', 'bumpiness', 'number'),
|
|
184
|
-
property('Specular', 'specular', 'rgb'),
|
|
185
|
-
property('Glossiness', 'gloss', 'number'),
|
|
186
|
-
property('Opacity', 'opacity', 'number'),
|
|
187
|
-
property('Opacity Map', 'opacityMap', 'texture'),
|
|
188
|
-
property('Metalness', 'metalness', 'number'),
|
|
189
|
-
property('Reflectivity', 'reflectivity', 'number'),
|
|
190
|
-
property('Refraction', 'refraction', 'number'),
|
|
191
|
-
property('Refraction Index', 'refractionIndex', 'number'),
|
|
211
|
+
(0, code_nodes_1.property)('Diffuse Map', 'diffuseMap', 'texture', 'filler_texture_diffuseMap'),
|
|
212
|
+
(0, code_nodes_1.property)('Normal Map', 'normalMap', 'texture', 'filler_texture_normalMap'),
|
|
213
|
+
(0, code_nodes_1.property)('Bumpiness', 'bumpiness', 'number'),
|
|
214
|
+
(0, code_nodes_1.property)('Specular', 'specular', 'rgb'),
|
|
215
|
+
(0, code_nodes_1.property)('Glossiness', 'gloss', 'number'),
|
|
216
|
+
(0, code_nodes_1.property)('Opacity', 'opacity', 'number'),
|
|
217
|
+
(0, code_nodes_1.property)('Opacity Map', 'opacityMap', 'texture'),
|
|
218
|
+
(0, code_nodes_1.property)('Metalness', 'metalness', 'number'),
|
|
219
|
+
(0, code_nodes_1.property)('Reflectivity', 'reflectivity', 'number'),
|
|
220
|
+
(0, code_nodes_1.property)('Refraction', 'refraction', 'number'),
|
|
221
|
+
(0, code_nodes_1.property)('Refraction Index', 'refractionIndex', 'number'),
|
|
192
222
|
// property('Bump Map', 'bumpTexture', 'texture', 'filler_bumpSampler'),
|
|
193
223
|
// property('Metalness', 'metallic', 'number'),
|
|
194
224
|
// property('Roughness', 'roughness', 'number'),
|
|
@@ -204,12 +234,12 @@ export var physicalNode = function (id, name, position, uniforms, stage) {
|
|
|
204
234
|
// property('Micro Surface', 'microSurface', 'number'),
|
|
205
235
|
// property('Reflectivity Color', 'reflectivityColor', 'rgb'),
|
|
206
236
|
],
|
|
207
|
-
hardCodedProperties: physicalDefaultProperties,
|
|
237
|
+
hardCodedProperties: exports.physicalDefaultProperties,
|
|
208
238
|
strategies: [
|
|
209
|
-
uniformStrategy(),
|
|
239
|
+
(0, strategy_1.uniformStrategy)(),
|
|
210
240
|
stage === 'fragment'
|
|
211
|
-
? texture2DStrategy()
|
|
212
|
-
: namedAttributeStrategy('vertex_position'),
|
|
241
|
+
? (0, strategy_1.texture2DStrategy)()
|
|
242
|
+
: (0, strategy_1.namedAttributeStrategy)('vertex_position'),
|
|
213
243
|
],
|
|
214
244
|
},
|
|
215
245
|
inputs: [],
|
|
@@ -225,32 +255,33 @@ export var physicalNode = function (id, name, position, uniforms, stage) {
|
|
|
225
255
|
stage: stage,
|
|
226
256
|
});
|
|
227
257
|
};
|
|
228
|
-
|
|
229
|
-
|
|
258
|
+
exports.physicalNode = physicalNode;
|
|
259
|
+
var toonNode = function (id, name, position, uniforms, stage) {
|
|
260
|
+
return (0, graph_1.prepopulatePropertyInputs)({
|
|
230
261
|
id: id,
|
|
231
262
|
name: name,
|
|
232
263
|
position: position,
|
|
233
264
|
engine: true,
|
|
234
|
-
type: EngineNodeType.toon,
|
|
265
|
+
type: engine_1.EngineNodeType.toon,
|
|
235
266
|
config: {
|
|
236
267
|
uniforms: uniforms,
|
|
237
268
|
version: 3,
|
|
238
269
|
preprocess: true,
|
|
239
270
|
mangle: false,
|
|
240
271
|
properties: [
|
|
241
|
-
property('Color', 'color', 'rgb', 'uniform_diffuse'),
|
|
242
|
-
property('Texture', 'map', 'texture', 'filler_map'),
|
|
243
|
-
property('Gradient Map', 'gradientMap', 'texture', 'filler_gradientMap'),
|
|
244
|
-
property('Normal Map', 'normalMap', 'texture', 'filler_normalMap'),
|
|
245
|
-
property('Normal Scale', 'normalScale', 'vector2'),
|
|
246
|
-
property('Displacement Map', 'displacementMap', 'texture'),
|
|
247
|
-
property('Env Map', 'envMap', 'samplerCube'),
|
|
272
|
+
(0, code_nodes_1.property)('Color', 'color', 'rgb', 'uniform_diffuse'),
|
|
273
|
+
(0, code_nodes_1.property)('Texture', 'map', 'texture', 'filler_map'),
|
|
274
|
+
(0, code_nodes_1.property)('Gradient Map', 'gradientMap', 'texture', 'filler_gradientMap'),
|
|
275
|
+
(0, code_nodes_1.property)('Normal Map', 'normalMap', 'texture', 'filler_normalMap'),
|
|
276
|
+
(0, code_nodes_1.property)('Normal Scale', 'normalScale', 'vector2'),
|
|
277
|
+
(0, code_nodes_1.property)('Displacement Map', 'displacementMap', 'texture'),
|
|
278
|
+
(0, code_nodes_1.property)('Env Map', 'envMap', 'samplerCube'),
|
|
248
279
|
],
|
|
249
280
|
strategies: [
|
|
250
|
-
uniformStrategy(),
|
|
281
|
+
(0, strategy_1.uniformStrategy)(),
|
|
251
282
|
stage === 'fragment'
|
|
252
|
-
? texture2DStrategy()
|
|
253
|
-
: namedAttributeStrategy('position'),
|
|
283
|
+
? (0, strategy_1.texture2DStrategy)()
|
|
284
|
+
: (0, strategy_1.namedAttributeStrategy)('position'),
|
|
254
285
|
],
|
|
255
286
|
},
|
|
256
287
|
inputs: [],
|
|
@@ -266,8 +297,9 @@ export var toonNode = function (id, name, position, uniforms, stage) {
|
|
|
266
297
|
stage: stage,
|
|
267
298
|
});
|
|
268
299
|
};
|
|
269
|
-
|
|
270
|
-
|
|
300
|
+
exports.toonNode = toonNode;
|
|
301
|
+
exports.mIdx = 0;
|
|
302
|
+
var id = function () { return exports.mIdx++; };
|
|
271
303
|
var nodeCacheKey = function (graph, node) {
|
|
272
304
|
return ('[ID:' +
|
|
273
305
|
node.id +
|
|
@@ -391,18 +423,18 @@ var onBeforeCompileMegaShader = function (engineContext, graph, node, sibling) {
|
|
|
391
423
|
// TODO: NEED TO DO SAME THREE MANGLIGN STEP HERE
|
|
392
424
|
var megaShaderMainpulateAst = function (engineContext, engine, graph, ast, inputEdges, node, sibling) {
|
|
393
425
|
var programAst = ast;
|
|
394
|
-
var mainName = 'main' || nodeName(node);
|
|
426
|
+
var mainName = 'main' || (0, graph_1.nodeName)(node);
|
|
395
427
|
if (node.stage === 'vertex') {
|
|
396
|
-
if (doesLinkThruShader(graph, node)) {
|
|
397
|
-
returnGlPositionHardCoded(mainName, programAst, 'vec3', 'transformed');
|
|
428
|
+
if ((0, graph_1.doesLinkThruShader)(graph, node)) {
|
|
429
|
+
(0, ast_1.returnGlPositionHardCoded)(mainName, programAst, 'vec3', 'transformed');
|
|
398
430
|
}
|
|
399
431
|
else {
|
|
400
|
-
returnGlPosition(mainName, programAst);
|
|
432
|
+
(0, ast_1.returnGlPosition)(mainName, programAst);
|
|
401
433
|
}
|
|
402
434
|
}
|
|
403
435
|
// We specify engine nodes are mangle: false, which is the graph step that
|
|
404
436
|
// handles renaming the main fn, so we have to do it ourselves
|
|
405
|
-
mangleMainFn(programAst, node, sibling);
|
|
437
|
+
(0, graph_1.mangleMainFn)(programAst, node, sibling);
|
|
406
438
|
return programAst;
|
|
407
439
|
};
|
|
408
440
|
var evaluateNode = function (node) {
|
|
@@ -453,18 +485,18 @@ var evaluateNode = function (node) {
|
|
|
453
485
|
return node.value;
|
|
454
486
|
}
|
|
455
487
|
};
|
|
456
|
-
|
|
488
|
+
exports.playengine = {
|
|
457
489
|
name: 'playcanvas',
|
|
458
490
|
displayName: 'PlayCanvas',
|
|
459
|
-
importers:
|
|
491
|
+
importers: importers_1.default,
|
|
460
492
|
mergeOptions: {
|
|
461
493
|
includePrecisions: true,
|
|
462
494
|
includeVersion: false,
|
|
463
495
|
},
|
|
464
496
|
evaluateNode: evaluateNode,
|
|
465
497
|
constructors: (_a = {},
|
|
466
|
-
_a[EngineNodeType.physical] = physicalNode,
|
|
467
|
-
_a[EngineNodeType.toon] = toonNode,
|
|
498
|
+
_a[engine_1.EngineNodeType.physical] = exports.physicalNode,
|
|
499
|
+
_a[engine_1.EngineNodeType.toon] = exports.toonNode,
|
|
468
500
|
_a),
|
|
469
501
|
// TODO: Move into core based on engine shader scrape
|
|
470
502
|
preserve: new Set([
|
|
@@ -485,23 +517,23 @@ export var playengine = {
|
|
|
485
517
|
'vUv0',
|
|
486
518
|
]),
|
|
487
519
|
parsers: (_b = {},
|
|
488
|
-
_b[NodeType.SOURCE] = {
|
|
520
|
+
_b[graph_types_1.NodeType.SOURCE] = {
|
|
489
521
|
manipulateAst: function (engineContext, engine, graph, ast, inputEdges, node, sibling) {
|
|
490
522
|
var programAst = ast;
|
|
491
|
-
var mainName = 'main' || nodeName(node);
|
|
523
|
+
var mainName = 'main' || (0, graph_1.nodeName)(node);
|
|
492
524
|
// This hinges on the vertex shader calling vec3(p)
|
|
493
525
|
if (node.stage === 'vertex') {
|
|
494
|
-
if (doesLinkThruShader(graph, node)) {
|
|
495
|
-
returnGlPositionVec3Right(mainName, programAst);
|
|
526
|
+
if ((0, graph_1.doesLinkThruShader)(graph, node)) {
|
|
527
|
+
(0, ast_1.returnGlPositionVec3Right)(mainName, programAst);
|
|
496
528
|
}
|
|
497
529
|
else {
|
|
498
|
-
returnGlPosition(mainName, programAst);
|
|
530
|
+
(0, ast_1.returnGlPosition)(mainName, programAst);
|
|
499
531
|
}
|
|
500
532
|
}
|
|
501
533
|
return ast;
|
|
502
534
|
},
|
|
503
535
|
},
|
|
504
|
-
_b[EngineNodeType.physical] = {
|
|
536
|
+
_b[engine_1.EngineNodeType.physical] = {
|
|
505
537
|
onBeforeCompile: function (graph, engineContext, node, sibling) {
|
|
506
538
|
return cacher(engineContext, graph, node, sibling, function () {
|
|
507
539
|
return onBeforeCompileMegaShader(engineContext, graph, node, sibling);
|
|
@@ -511,7 +543,7 @@ export var playengine = {
|
|
|
511
543
|
},
|
|
512
544
|
_b),
|
|
513
545
|
};
|
|
514
|
-
playengine.parsers[EngineNodeType.toon] =
|
|
515
|
-
playengine.parsers[EngineNodeType.physical];
|
|
516
|
-
playengine.parsers[EngineNodeType.phong] =
|
|
517
|
-
playengine.parsers[EngineNodeType.physical];
|
|
546
|
+
exports.playengine.parsers[engine_1.EngineNodeType.toon] =
|
|
547
|
+
exports.playengine.parsers[engine_1.EngineNodeType.physical];
|
|
548
|
+
exports.playengine.parsers[engine_1.EngineNodeType.phong] =
|
|
549
|
+
exports.playengine.parsers[engine_1.EngineNodeType.physical];
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var utils_1 = require("@shaderfrog/glsl-parser/parser/utils");
|
|
2
4
|
var importers = {
|
|
3
5
|
babylon: {
|
|
4
6
|
convertAst: function (ast, type) {
|
|
5
|
-
renameBindings(ast.scopes[0], function (name) {
|
|
7
|
+
(0, utils_1.renameBindings)(ast.scopes[0], function (name) {
|
|
6
8
|
return name === 'vMainUV1' ? 'vUv' : name === 'vNormalW' ? 'vNormal' : name;
|
|
7
9
|
});
|
|
8
10
|
},
|
|
@@ -12,4 +14,4 @@ var importers = {
|
|
|
12
14
|
},
|
|
13
15
|
},
|
|
14
16
|
};
|
|
15
|
-
|
|
17
|
+
exports.default = importers;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.engine = exports.createMaterial = void 0;
|
|
4
|
+
var threngine_1 = require("./threngine");
|
|
5
|
+
Object.defineProperty(exports, "createMaterial", { enumerable: true, get: function () { return threngine_1.createMaterial; } });
|
|
6
|
+
Object.defineProperty(exports, "engine", { enumerable: true, get: function () { return threngine_1.threngine; } });
|