@shaderfrog/core 1.3.0 → 1.3.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/package.json +10 -7
- package/cjs/engine.js +0 -218
- package/cjs/graph/base-node.js +0 -13
- package/cjs/graph/code-nodes.js +0 -23
- package/cjs/graph/context.js +0 -253
- package/cjs/graph/data-nodes.js +0 -146
- package/cjs/graph/edge.js +0 -12
- package/cjs/graph/evaluate.js +0 -32
- package/cjs/graph/graph-node.js +0 -143
- package/cjs/graph/graph-types.js +0 -25
- package/cjs/graph/graph.js +0 -533
- package/cjs/graph/graph.test.js +0 -173
- package/cjs/graph/index.js +0 -27
- package/cjs/graph/parsers.js +0 -219
- package/cjs/graph/shader-sections.js +0 -268
- package/cjs/index.js +0 -19
- package/cjs/package.json +0 -1
- package/cjs/plugins/babylon/bablyengine.js +0 -597
- package/cjs/plugins/babylon/importers.js +0 -66
- package/cjs/plugins/babylon/index.js +0 -5
- package/cjs/plugins/playcanvas/importers.js +0 -30
- package/cjs/plugins/playcanvas/index.js +0 -5
- package/cjs/plugins/playcanvas/playengine.js +0 -549
- package/cjs/plugins/three/importers.js +0 -17
- package/cjs/plugins/three/index.js +0 -6
- package/cjs/plugins/three/threngine.js +0 -619
- package/cjs/strategy/assignemntTo.js +0 -31
- package/cjs/strategy/declarationOf.js +0 -28
- package/cjs/strategy/hardCode.js +0 -28
- package/cjs/strategy/index.js +0 -25
- package/cjs/strategy/inject.js +0 -127
- package/cjs/strategy/namedAttribute.js +0 -53
- package/cjs/strategy/strategy.js +0 -35
- package/cjs/strategy/stratgies.test.js +0 -192
- package/cjs/strategy/texture2D.js +0 -88
- package/cjs/strategy/uniform.js +0 -195
- package/cjs/strategy/variable.js +0 -85
- package/cjs/util/ast.js +0 -351
- package/cjs/util/ensure.js +0 -11
- package/cjs/util/id.js +0 -6
- package/esm/engine.d.ts +0 -69
- package/esm/graph/base-node.d.ts +0 -36
- package/esm/graph/code-nodes.d.ts +0 -44
- package/esm/graph/context.d.ts +0 -37
- package/esm/graph/data-nodes.d.ts +0 -83
- package/esm/graph/edge.d.ts +0 -13
- package/esm/graph/evaluate.d.ts +0 -9
- package/esm/graph/graph-node.d.ts +0 -8
- package/esm/graph/graph-types.d.ts +0 -38
- package/esm/graph/graph.d.ts +0 -89
- package/esm/graph/graph.test.d.ts +0 -1
- package/esm/graph/index.d.ts +0 -11
- package/esm/graph/parsers.d.ts +0 -39
- package/esm/graph/shader-sections.d.ts +0 -47
- package/esm/index.d.ts +0 -3
- package/esm/package.json +0 -1
- package/esm/plugins/babylon/bablyengine.d.ts +0 -28
- package/esm/plugins/babylon/importers.d.ts +0 -3
- package/esm/plugins/babylon/index.d.ts +0 -2
- package/esm/plugins/playcanvas/importers.d.ts +0 -3
- package/esm/plugins/playcanvas/index.d.ts +0 -2
- package/esm/plugins/playcanvas/playengine.d.ts +0 -39
- package/esm/plugins/three/importers.d.ts +0 -3
- package/esm/plugins/three/index.d.ts +0 -2
- package/esm/plugins/three/threngine.d.ts +0 -34
- package/esm/strategy/assignemntTo.d.ts +0 -9
- package/esm/strategy/declarationOf.d.ts +0 -9
- package/esm/strategy/hardCode.d.ts +0 -15
- package/esm/strategy/index.d.ts +0 -9
- package/esm/strategy/inject.d.ts +0 -15
- package/esm/strategy/namedAttribute.d.ts +0 -9
- package/esm/strategy/strategy.d.ts +0 -28
- package/esm/strategy/stratgies.test.d.ts +0 -1
- package/esm/strategy/texture2D.d.ts +0 -6
- package/esm/strategy/uniform.d.ts +0 -6
- package/esm/strategy/variable.d.ts +0 -6
- package/esm/util/ast.d.ts +0 -30
- package/esm/util/ensure.d.ts +0 -1
- package/esm/util/id.d.ts +0 -1
- /package/{cjs/engine.d.ts → engine.d.ts} +0 -0
- /package/{esm/engine.js → engine.js} +0 -0
- /package/{cjs/graph → graph}/base-node.d.ts +0 -0
- /package/{esm/graph → graph}/base-node.js +0 -0
- /package/{cjs/graph → graph}/code-nodes.d.ts +0 -0
- /package/{esm/graph → graph}/code-nodes.js +0 -0
- /package/{cjs/graph → graph}/context.d.ts +0 -0
- /package/{esm/graph → graph}/context.js +0 -0
- /package/{cjs/graph → graph}/data-nodes.d.ts +0 -0
- /package/{esm/graph → graph}/data-nodes.js +0 -0
- /package/{cjs/graph → graph}/edge.d.ts +0 -0
- /package/{esm/graph → graph}/edge.js +0 -0
- /package/{cjs/graph → graph}/evaluate.d.ts +0 -0
- /package/{esm/graph → graph}/evaluate.js +0 -0
- /package/{cjs/graph → graph}/graph-node.d.ts +0 -0
- /package/{esm/graph → graph}/graph-node.js +0 -0
- /package/{cjs/graph → graph}/graph-types.d.ts +0 -0
- /package/{esm/graph → graph}/graph-types.js +0 -0
- /package/{cjs/graph → graph}/graph.d.ts +0 -0
- /package/{esm/graph → graph}/graph.js +0 -0
- /package/{cjs/graph → graph}/graph.test.d.ts +0 -0
- /package/{esm/graph → graph}/graph.test.js +0 -0
- /package/{cjs/graph → graph}/index.d.ts +0 -0
- /package/{esm/graph → graph}/index.js +0 -0
- /package/{cjs/graph → graph}/parsers.d.ts +0 -0
- /package/{esm/graph → graph}/parsers.js +0 -0
- /package/{cjs/graph → graph}/shader-sections.d.ts +0 -0
- /package/{esm/graph → graph}/shader-sections.js +0 -0
- /package/{cjs/index.d.ts → index.d.ts} +0 -0
- /package/{esm/index.js → index.js} +0 -0
- /package/{cjs/plugins → plugins}/babylon/bablyengine.d.ts +0 -0
- /package/{esm/plugins → plugins}/babylon/bablyengine.js +0 -0
- /package/{cjs/plugins → plugins}/babylon/importers.d.ts +0 -0
- /package/{esm/plugins → plugins}/babylon/importers.js +0 -0
- /package/{cjs/plugins → plugins}/babylon/index.d.ts +0 -0
- /package/{esm/plugins → plugins}/babylon/index.js +0 -0
- /package/{cjs/plugins → plugins}/playcanvas/importers.d.ts +0 -0
- /package/{esm/plugins → plugins}/playcanvas/importers.js +0 -0
- /package/{cjs/plugins → plugins}/playcanvas/index.d.ts +0 -0
- /package/{esm/plugins → plugins}/playcanvas/index.js +0 -0
- /package/{cjs/plugins → plugins}/playcanvas/playengine.d.ts +0 -0
- /package/{esm/plugins → plugins}/playcanvas/playengine.js +0 -0
- /package/{cjs/plugins → plugins}/three/importers.d.ts +0 -0
- /package/{esm/plugins → plugins}/three/importers.js +0 -0
- /package/{cjs/plugins → plugins}/three/index.d.ts +0 -0
- /package/{esm/plugins → plugins}/three/index.js +0 -0
- /package/{cjs/plugins → plugins}/three/threngine.d.ts +0 -0
- /package/{esm/plugins → plugins}/three/threngine.js +0 -0
- /package/{cjs/strategy → strategy}/assignemntTo.d.ts +0 -0
- /package/{esm/strategy → strategy}/assignemntTo.js +0 -0
- /package/{cjs/strategy → strategy}/declarationOf.d.ts +0 -0
- /package/{esm/strategy → strategy}/declarationOf.js +0 -0
- /package/{cjs/strategy → strategy}/hardCode.d.ts +0 -0
- /package/{esm/strategy → strategy}/hardCode.js +0 -0
- /package/{cjs/strategy → strategy}/index.d.ts +0 -0
- /package/{esm/strategy → strategy}/index.js +0 -0
- /package/{cjs/strategy → strategy}/inject.d.ts +0 -0
- /package/{esm/strategy → strategy}/inject.js +0 -0
- /package/{cjs/strategy → strategy}/namedAttribute.d.ts +0 -0
- /package/{esm/strategy → strategy}/namedAttribute.js +0 -0
- /package/{cjs/strategy → strategy}/strategy.d.ts +0 -0
- /package/{esm/strategy → strategy}/strategy.js +0 -0
- /package/{cjs/strategy → strategy}/stratgies.test.d.ts +0 -0
- /package/{esm/strategy → strategy}/stratgies.test.js +0 -0
- /package/{cjs/strategy → strategy}/texture2D.d.ts +0 -0
- /package/{esm/strategy → strategy}/texture2D.js +0 -0
- /package/{cjs/strategy → strategy}/uniform.d.ts +0 -0
- /package/{esm/strategy → strategy}/uniform.js +0 -0
- /package/{cjs/strategy → strategy}/variable.d.ts +0 -0
- /package/{esm/strategy → strategy}/variable.js +0 -0
- /package/{cjs/util → util}/ast.d.ts +0 -0
- /package/{esm/util → util}/ast.js +0 -0
- /package/{cjs/util → util}/ensure.d.ts +0 -0
- /package/{esm/util → util}/ensure.js +0 -0
- /package/{cjs/util → util}/id.d.ts +0 -0
- /package/{esm/util → util}/id.js +0 -0
|
@@ -1,597 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
-
if (!m) return o;
|
|
52
|
-
var i = m.call(o), r, ar = [], e;
|
|
53
|
-
try {
|
|
54
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
-
}
|
|
56
|
-
catch (error) { e = { error: error }; }
|
|
57
|
-
finally {
|
|
58
|
-
try {
|
|
59
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
-
}
|
|
61
|
-
finally { if (e) throw e.error; }
|
|
62
|
-
}
|
|
63
|
-
return ar;
|
|
64
|
-
};
|
|
65
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
66
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
67
|
-
if (ar || !(i in from)) {
|
|
68
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
69
|
-
ar[i] = from[i];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
73
|
-
};
|
|
74
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
75
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
76
|
-
};
|
|
77
|
-
var _a, _b;
|
|
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");
|
|
88
|
-
// Setting these properties on the material have side effects, not just for the
|
|
89
|
-
// GLSL, but for the material itself in JS memory apparently, maybe the bound
|
|
90
|
-
// uniforms?. The material we create in babylengine must have the same initial
|
|
91
|
-
// properties as those in BabylonComponent or else there will be errors with
|
|
92
|
-
// uniforms
|
|
93
|
-
exports.physicalDefaultProperties = {
|
|
94
|
-
forceIrradianceInFragment: true,
|
|
95
|
-
albedoColor: new babylonjs_1.Color3(1.0, 1.0, 1.0),
|
|
96
|
-
metallic: 0.0,
|
|
97
|
-
roughness: 1.0,
|
|
98
|
-
};
|
|
99
|
-
var log = function () {
|
|
100
|
-
var _a;
|
|
101
|
-
var args = [];
|
|
102
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
103
|
-
args[_i] = arguments[_i];
|
|
104
|
-
}
|
|
105
|
-
return (_a = console.log).call.apply(_a, __spreadArray([console, '\x1b[33m(babylengine)\x1b[0m'], __read(args), false));
|
|
106
|
-
};
|
|
107
|
-
var babylonHackCache = {};
|
|
108
|
-
var physicalNode = function (id, name, position, uniforms, stage) {
|
|
109
|
-
return (0, graph_1.prepopulatePropertyInputs)({
|
|
110
|
-
id: id,
|
|
111
|
-
name: 'PBRMaterial',
|
|
112
|
-
position: position,
|
|
113
|
-
engine: true,
|
|
114
|
-
type: engine_1.EngineNodeType.physical,
|
|
115
|
-
config: {
|
|
116
|
-
uniforms: uniforms,
|
|
117
|
-
version: 3,
|
|
118
|
-
mangle: false,
|
|
119
|
-
preprocess: true,
|
|
120
|
-
properties: [
|
|
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'),
|
|
138
|
-
],
|
|
139
|
-
hardCodedProperties: exports.physicalDefaultProperties,
|
|
140
|
-
strategies: [
|
|
141
|
-
(0, strategy_1.uniformStrategy)(),
|
|
142
|
-
stage === 'fragment'
|
|
143
|
-
? (0, strategy_1.texture2DStrategy)()
|
|
144
|
-
: (0, strategy_1.namedAttributeStrategy)('position'),
|
|
145
|
-
],
|
|
146
|
-
},
|
|
147
|
-
inputs: [],
|
|
148
|
-
outputs: [
|
|
149
|
-
{
|
|
150
|
-
name: 'vector4',
|
|
151
|
-
dataType: 'vector4',
|
|
152
|
-
category: 'data',
|
|
153
|
-
id: '1',
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
source: '',
|
|
157
|
-
stage: stage,
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
exports.physicalNode = physicalNode;
|
|
161
|
-
var toonNode = function (id, name, position, uniforms, stage) {
|
|
162
|
-
return (0, graph_1.prepopulatePropertyInputs)({
|
|
163
|
-
id: id,
|
|
164
|
-
name: name,
|
|
165
|
-
position: position,
|
|
166
|
-
engine: true,
|
|
167
|
-
type: engine_1.EngineNodeType.toon,
|
|
168
|
-
config: {
|
|
169
|
-
uniforms: uniforms,
|
|
170
|
-
version: 3,
|
|
171
|
-
preprocess: true,
|
|
172
|
-
mangle: false,
|
|
173
|
-
properties: [
|
|
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'),
|
|
181
|
-
],
|
|
182
|
-
strategies: [
|
|
183
|
-
(0, strategy_1.uniformStrategy)(),
|
|
184
|
-
stage === 'fragment'
|
|
185
|
-
? (0, strategy_1.texture2DStrategy)()
|
|
186
|
-
: (0, strategy_1.namedAttributeStrategy)('position'),
|
|
187
|
-
],
|
|
188
|
-
},
|
|
189
|
-
inputs: [],
|
|
190
|
-
outputs: [
|
|
191
|
-
{
|
|
192
|
-
name: 'vector4',
|
|
193
|
-
dataType: 'vector4',
|
|
194
|
-
category: 'data',
|
|
195
|
-
id: '1',
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
source: '',
|
|
199
|
-
stage: stage,
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
exports.toonNode = toonNode;
|
|
203
|
-
var babylonMaterialProperties = function (scene, graph, node, sibling) {
|
|
204
|
-
// Find inputs to this node that are dependent on a property of the material
|
|
205
|
-
var propertyInputs = node.inputs
|
|
206
|
-
.filter(function (i) { return i.property; })
|
|
207
|
-
.reduce(function (acc, input) {
|
|
208
|
-
var _a;
|
|
209
|
-
return (__assign(__assign({}, acc), (_a = {}, _a[input.id] = input, _a)));
|
|
210
|
-
}, {});
|
|
211
|
-
// Then look for any edges into those inputs and set the material property
|
|
212
|
-
var props = graph.edges
|
|
213
|
-
.filter(function (edge) { return edge.to === node.id || edge.to === (sibling === null || sibling === void 0 ? void 0 : sibling.id); })
|
|
214
|
-
.reduce(function (acc, edge) {
|
|
215
|
-
// Check if we've plugged into an input for a property
|
|
216
|
-
var propertyInput = propertyInputs[edge.input];
|
|
217
|
-
if (propertyInput) {
|
|
218
|
-
// Find the property itself
|
|
219
|
-
var property_1 = (node.config.properties || []).find(function (p) { return p.property === propertyInput.property; });
|
|
220
|
-
// Initialize the property on the material
|
|
221
|
-
if (property_1.type === 'texture') {
|
|
222
|
-
acc[property_1.property] = new babylonjs_1.Texture('', scene);
|
|
223
|
-
}
|
|
224
|
-
else if (property_1.type === 'number') {
|
|
225
|
-
acc[property_1.property] = 0.5;
|
|
226
|
-
}
|
|
227
|
-
else if (property_1.type === 'rgb') {
|
|
228
|
-
acc[property_1.property] = new babylonjs_1.Color3(1, 1, 1);
|
|
229
|
-
}
|
|
230
|
-
else if (property_1.type === 'rgba') {
|
|
231
|
-
acc[property_1.property] = new babylonjs_1.Color4(1, 1, 1, 1);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return acc;
|
|
235
|
-
}, {});
|
|
236
|
-
return props;
|
|
237
|
-
};
|
|
238
|
-
exports.mIdx = 0;
|
|
239
|
-
var id = function () { return exports.mIdx++; };
|
|
240
|
-
var nodeCacheKey = function (graph, node) {
|
|
241
|
-
return ('[ID:' +
|
|
242
|
-
node.id +
|
|
243
|
-
'Edges:' +
|
|
244
|
-
graph.edges
|
|
245
|
-
.filter(function (edge) { return edge.to === node.id; })
|
|
246
|
-
.map(function (edge) { return "(".concat(edge.to, "->").concat(edge.input, ")"); })
|
|
247
|
-
.sort()
|
|
248
|
-
.join(',') +
|
|
249
|
-
']'
|
|
250
|
-
// Currently excluding node inputs because these are calculated *after*
|
|
251
|
-
// the onbeforecompile, so the next compile, they'll all change!
|
|
252
|
-
// node.inputs.map((i) => `${i.id}${i.bakeable}`)
|
|
253
|
-
);
|
|
254
|
-
};
|
|
255
|
-
var programCacheKey = function (engineContext, graph, node, sibling) {
|
|
256
|
-
// The megashader source is dependent on scene information, like the number
|
|
257
|
-
// and type of lights in the scene. This kinda sucks - it's duplicating
|
|
258
|
-
// three's material cache key, and is coupled to how three builds shaders
|
|
259
|
-
var scene = engineContext.runtime.scene;
|
|
260
|
-
var lights = scene.getNodes().filter(function (n) { return n instanceof babylonjs_1.Light; });
|
|
261
|
-
return ([node, sibling]
|
|
262
|
-
.filter(function (n) { return !!n; })
|
|
263
|
-
.sort(function (a, b) { return a.id.localeCompare(b.id); })
|
|
264
|
-
.map(function (n) { return nodeCacheKey(graph, n); })
|
|
265
|
-
.join('-') +
|
|
266
|
-
'|Lights:' +
|
|
267
|
-
lights.join(',') +
|
|
268
|
-
'|Envtex:' +
|
|
269
|
-
scene.environmentTexture);
|
|
270
|
-
};
|
|
271
|
-
var cacher = function (engineContext, graph, node, sibling, newValue) { return __awaiter(void 0, void 0, void 0, function () {
|
|
272
|
-
var cacheKey, materialData;
|
|
273
|
-
return __generator(this, function (_a) {
|
|
274
|
-
switch (_a.label) {
|
|
275
|
-
case 0:
|
|
276
|
-
cacheKey = programCacheKey(engineContext, graph, node, sibling);
|
|
277
|
-
if (engineContext.runtime.cache.data[cacheKey]) {
|
|
278
|
-
log("Cache hit \"".concat(cacheKey, "\""));
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
log("Cache miss \"".concat(cacheKey, "\""));
|
|
282
|
-
}
|
|
283
|
-
return [4 /*yield*/, (engineContext.runtime.cache.data[cacheKey] ||
|
|
284
|
-
newValue())];
|
|
285
|
-
case 1:
|
|
286
|
-
materialData = _a.sent();
|
|
287
|
-
log("Material cache \"".concat(cacheKey, "\" is now"), materialData);
|
|
288
|
-
engineContext.runtime.cache.data[cacheKey] = materialData;
|
|
289
|
-
engineContext.runtime.engineMaterial = materialData.material;
|
|
290
|
-
// TODO: We mutate the nodes here, can we avoid that later?
|
|
291
|
-
node.source =
|
|
292
|
-
node.stage === 'fragment' ? materialData.fragment : materialData.vertex;
|
|
293
|
-
if (sibling) {
|
|
294
|
-
sibling.source =
|
|
295
|
-
sibling.stage === 'fragment'
|
|
296
|
-
? materialData.fragment
|
|
297
|
-
: materialData.vertex;
|
|
298
|
-
}
|
|
299
|
-
return [2 /*return*/];
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
}); };
|
|
303
|
-
var onBeforeCompileMegaShader = function (engineContext, graph, node, sibling) { return __awaiter(void 0, void 0, void 0, function () {
|
|
304
|
-
var _a, scene, sceneData, pbrName, shaderMaterial, newProperties, vertexSource, fragmentSource, genHackCacheKey, hackKey;
|
|
305
|
-
var _b;
|
|
306
|
-
return __generator(this, function (_c) {
|
|
307
|
-
_a = engineContext.runtime, scene = _a.scene, sceneData = _a.sceneData;
|
|
308
|
-
pbrName = "engine_pbr".concat(id());
|
|
309
|
-
shaderMaterial = new babylonjs_1.PBRMaterial(pbrName, scene);
|
|
310
|
-
shaderMaterial.linkRefractionWithTransparency = true;
|
|
311
|
-
shaderMaterial.subSurface.isRefractionEnabled = true;
|
|
312
|
-
newProperties = __assign(__assign({}, (node.config.hardCodedProperties ||
|
|
313
|
-
((_b = sibling === null || sibling === void 0 ? void 0 : sibling.config) === null || _b === void 0 ? void 0 : _b.hardCodedProperties) ||
|
|
314
|
-
{})), babylonMaterialProperties(scene, graph, node, sibling));
|
|
315
|
-
Object.assign(shaderMaterial, newProperties);
|
|
316
|
-
log('Engine megashader initial properties', { newProperties: newProperties });
|
|
317
|
-
genHackCacheKey = function (unknown) {
|
|
318
|
-
return unknown.toString();
|
|
319
|
-
};
|
|
320
|
-
return [2 /*return*/, new Promise(function (resolve) {
|
|
321
|
-
shaderMaterial.customShaderNameResolve = function (shaderName, uniforms, uniformBuffers, samplers, defines, attributes, options) {
|
|
322
|
-
hackKey = genHackCacheKey(defines);
|
|
323
|
-
log('Babylengine creating new shader', {
|
|
324
|
-
uniforms: uniforms,
|
|
325
|
-
uniformBuffers: uniformBuffers,
|
|
326
|
-
samplers: samplers,
|
|
327
|
-
defines: defines,
|
|
328
|
-
attributes: attributes,
|
|
329
|
-
options: options,
|
|
330
|
-
});
|
|
331
|
-
if (options) {
|
|
332
|
-
options.processFinalCode = function (type, code) {
|
|
333
|
-
// If babylon thinks it has cached code for a new shader,
|
|
334
|
-
// processFinalCode doesn't get called. This hack attempt is to try to
|
|
335
|
-
// recreate Babylon's internal cache, based on my understanding that
|
|
336
|
-
// babylon looks to the defines to determine shader uniqueness
|
|
337
|
-
babylonHackCache[hackKey] = babylonHackCache[hackKey] || {
|
|
338
|
-
fragment: '',
|
|
339
|
-
vertex: '',
|
|
340
|
-
};
|
|
341
|
-
if (type === 'vertex') {
|
|
342
|
-
log('captured vertex code', { code: code });
|
|
343
|
-
vertexSource = code;
|
|
344
|
-
babylonHackCache[hackKey].vertex = code;
|
|
345
|
-
return code;
|
|
346
|
-
}
|
|
347
|
-
else if (type === 'fragment') {
|
|
348
|
-
log('captured fragment code', { code: code });
|
|
349
|
-
fragmentSource = code;
|
|
350
|
-
babylonHackCache[hackKey].fragment = code;
|
|
351
|
-
return code;
|
|
352
|
-
}
|
|
353
|
-
throw new Error("Unknown type ".concat(type));
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
console.warn('No options for', pbrName);
|
|
358
|
-
}
|
|
359
|
-
return shaderName;
|
|
360
|
-
};
|
|
361
|
-
if (!sceneData.mesh) {
|
|
362
|
-
log('🍃 EFF, no MESHREF RENDER()....');
|
|
363
|
-
}
|
|
364
|
-
shaderMaterial.forceCompilation(sceneData.mesh, function (compiledMaterial) {
|
|
365
|
-
var _a, _b;
|
|
366
|
-
log('Babylon shader compilation done!');
|
|
367
|
-
if (!fragmentSource || !vertexSource) {
|
|
368
|
-
log('Reusing previous mesh render...');
|
|
369
|
-
vertexSource = (_a = babylonHackCache[hackKey]) === null || _a === void 0 ? void 0 : _a.vertex;
|
|
370
|
-
fragmentSource = (_b = babylonHackCache[hackKey]) === null || _b === void 0 ? void 0 : _b.fragment;
|
|
371
|
-
}
|
|
372
|
-
if (!fragmentSource || !vertexSource) {
|
|
373
|
-
debugger;
|
|
374
|
-
}
|
|
375
|
-
log('captured', { fragmentSource: fragmentSource, vertexSource: vertexSource });
|
|
376
|
-
if (node.stage === 'fragment') {
|
|
377
|
-
node.source = fragmentSource;
|
|
378
|
-
}
|
|
379
|
-
if ((sibling === null || sibling === void 0 ? void 0 : sibling.stage) === 'fragment') {
|
|
380
|
-
sibling.source = fragmentSource;
|
|
381
|
-
}
|
|
382
|
-
if (node.stage === 'vertex') {
|
|
383
|
-
node.source = vertexSource;
|
|
384
|
-
}
|
|
385
|
-
if ((sibling === null || sibling === void 0 ? void 0 : sibling.stage) === 'vertex') {
|
|
386
|
-
sibling.source = vertexSource;
|
|
387
|
-
}
|
|
388
|
-
engineContext.runtime.cache.nodes[node.id] = {
|
|
389
|
-
// fragmentRef,
|
|
390
|
-
// vertexRef,
|
|
391
|
-
fragment: fragmentSource,
|
|
392
|
-
vertex: vertexSource,
|
|
393
|
-
};
|
|
394
|
-
// This doesn't appear to do anything (see comment above submeshes)
|
|
395
|
-
compiledMaterial.dispose(true);
|
|
396
|
-
resolve({
|
|
397
|
-
material: compiledMaterial,
|
|
398
|
-
fragment: fragmentSource,
|
|
399
|
-
vertex: vertexSource,
|
|
400
|
-
});
|
|
401
|
-
});
|
|
402
|
-
})];
|
|
403
|
-
});
|
|
404
|
-
}); };
|
|
405
|
-
// TODO: NEED TO DO SAME THREE MANGLIGN STEP HERE
|
|
406
|
-
var megaShaderMainpulateAst = function (engineContext, engine, graph, ast, inputEdges, node, sibling) {
|
|
407
|
-
var programAst = ast;
|
|
408
|
-
var mainName = 'main' || (0, graph_1.nodeName)(node);
|
|
409
|
-
if (node.stage === 'vertex') {
|
|
410
|
-
if ((0, graph_1.doesLinkThruShader)(graph, node)) {
|
|
411
|
-
(0, ast_1.returnGlPositionHardCoded)(mainName, programAst, 'vec3', 'transformed');
|
|
412
|
-
}
|
|
413
|
-
else {
|
|
414
|
-
(0, ast_1.returnGlPosition)(mainName, programAst);
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
// We specify engine nodes are mangle: false, which is the graph step that
|
|
418
|
-
// handles renaming the main fn, so we have to do it ourselves
|
|
419
|
-
(0, graph_1.mangleMainFn)(programAst, node, sibling);
|
|
420
|
-
return programAst;
|
|
421
|
-
};
|
|
422
|
-
var evaluateNode = function (node) {
|
|
423
|
-
if (node.type === 'number') {
|
|
424
|
-
return parseFloat(node.value);
|
|
425
|
-
}
|
|
426
|
-
if (node.type === 'vector2') {
|
|
427
|
-
return new babylonjs_1.Vector2(parseFloat(node.value[0]), parseFloat(node.value[1]));
|
|
428
|
-
}
|
|
429
|
-
else if (node.type === 'vector3') {
|
|
430
|
-
return new babylonjs_1.Vector3(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]));
|
|
431
|
-
}
|
|
432
|
-
else if (node.type === 'vector4') {
|
|
433
|
-
return new babylonjs_1.Vector4(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]), parseFloat(node.value[3]));
|
|
434
|
-
}
|
|
435
|
-
else if (node.type === 'rgb') {
|
|
436
|
-
return new babylonjs_1.Color3(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]));
|
|
437
|
-
}
|
|
438
|
-
else if (node.type === 'rgba') {
|
|
439
|
-
return new babylonjs_1.Color4(parseFloat(node.value[0]), parseFloat(node.value[1]), parseFloat(node.value[2]), parseFloat(node.value[3]));
|
|
440
|
-
}
|
|
441
|
-
else {
|
|
442
|
-
return node.value;
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
exports.babylengine = {
|
|
446
|
-
name: 'babylon',
|
|
447
|
-
displayName: 'Babylon.js',
|
|
448
|
-
importers: importers_1.default,
|
|
449
|
-
mergeOptions: {
|
|
450
|
-
includePrecisions: true,
|
|
451
|
-
includeVersion: false,
|
|
452
|
-
},
|
|
453
|
-
evaluateNode: evaluateNode,
|
|
454
|
-
constructors: (_a = {},
|
|
455
|
-
_a[engine_1.EngineNodeType.physical] = exports.physicalNode,
|
|
456
|
-
_a[engine_1.EngineNodeType.toon] = exports.toonNode,
|
|
457
|
-
_a),
|
|
458
|
-
// TODO: Get from uniform lib?
|
|
459
|
-
preserve: new Set([
|
|
460
|
-
'viewProjection',
|
|
461
|
-
'normalMatrix',
|
|
462
|
-
'vAmbientInfos',
|
|
463
|
-
'vOpacityInfos',
|
|
464
|
-
'vEmissiveInfos',
|
|
465
|
-
'vLightmapInfos',
|
|
466
|
-
'vReflectivityInfos',
|
|
467
|
-
'vMicroSurfaceSamplerInfos',
|
|
468
|
-
'vReflectionInfos',
|
|
469
|
-
'vReflectionFilteringInfo',
|
|
470
|
-
'vReflectionPosition',
|
|
471
|
-
'vReflectionSize',
|
|
472
|
-
'vBumpInfos',
|
|
473
|
-
'albedoMatrix',
|
|
474
|
-
'ambientMatrix',
|
|
475
|
-
'opacityMatrix',
|
|
476
|
-
'emissiveMatrix',
|
|
477
|
-
'lightmapMatrix',
|
|
478
|
-
'reflectivityMatrix',
|
|
479
|
-
'microSurfaceSamplerMatrix',
|
|
480
|
-
'bumpMatrix',
|
|
481
|
-
'bumpSampler',
|
|
482
|
-
'vTangentSpaceParams',
|
|
483
|
-
'reflectionMatrix',
|
|
484
|
-
'vReflectionColor',
|
|
485
|
-
'vAlbedoColor',
|
|
486
|
-
'vLightingIntensity',
|
|
487
|
-
'vReflectionMicrosurfaceInfos',
|
|
488
|
-
'pointSize',
|
|
489
|
-
'vReflectivityColor',
|
|
490
|
-
'vEmissiveColor',
|
|
491
|
-
'visibility',
|
|
492
|
-
'vMetallicReflectanceFactors',
|
|
493
|
-
'vMetallicReflectanceInfos',
|
|
494
|
-
'metallicReflectanceMatrix',
|
|
495
|
-
'vClearCoatParams',
|
|
496
|
-
'vClearCoatRefractionParams',
|
|
497
|
-
'vClearCoatInfos',
|
|
498
|
-
'clearCoatMatrix',
|
|
499
|
-
'clearCoatRoughnessMatrix',
|
|
500
|
-
'vClearCoatBumpInfos',
|
|
501
|
-
'vClearCoatTangentSpaceParams',
|
|
502
|
-
'clearCoatBumpMatrix',
|
|
503
|
-
'vClearCoatTintParams',
|
|
504
|
-
'clearCoatColorAtDistance',
|
|
505
|
-
'vClearCoatTintInfos',
|
|
506
|
-
'clearCoatTintMatrix',
|
|
507
|
-
'vAnisotropy',
|
|
508
|
-
'vAnisotropyInfos',
|
|
509
|
-
'anisotropyMatrix',
|
|
510
|
-
'vSheenColor',
|
|
511
|
-
'vSheenRoughness',
|
|
512
|
-
'vSheenInfos',
|
|
513
|
-
'sheenMatrix',
|
|
514
|
-
'sheenRoughnessMatrix',
|
|
515
|
-
'vRefractionMicrosurfaceInfos',
|
|
516
|
-
'vRefractionFilteringInfo',
|
|
517
|
-
'vRefractionInfos',
|
|
518
|
-
'refractionMatrix',
|
|
519
|
-
'vThicknessInfos',
|
|
520
|
-
'thicknessMatrix',
|
|
521
|
-
'vThicknessParam',
|
|
522
|
-
'vDiffusionDistance',
|
|
523
|
-
'vTintColor',
|
|
524
|
-
'vSubSurfaceIntensity',
|
|
525
|
-
'scatteringDiffusionProfile',
|
|
526
|
-
'vDetailInfos',
|
|
527
|
-
'detailMatrix',
|
|
528
|
-
'Scene',
|
|
529
|
-
'vEyePosition',
|
|
530
|
-
'vAmbientColor',
|
|
531
|
-
'vCameraInfos',
|
|
532
|
-
'vPositionW',
|
|
533
|
-
'vMainUV1',
|
|
534
|
-
'vNormalW',
|
|
535
|
-
'Light0',
|
|
536
|
-
'albedoSampler',
|
|
537
|
-
'environmentBrdfSampler',
|
|
538
|
-
'position',
|
|
539
|
-
'normal',
|
|
540
|
-
'uv',
|
|
541
|
-
'world',
|
|
542
|
-
'time',
|
|
543
|
-
'Light0',
|
|
544
|
-
'Light1',
|
|
545
|
-
'Light2',
|
|
546
|
-
'Light3',
|
|
547
|
-
'light0',
|
|
548
|
-
'light1',
|
|
549
|
-
'light2',
|
|
550
|
-
'light3',
|
|
551
|
-
'vLightData0',
|
|
552
|
-
'vLightDiffuse0',
|
|
553
|
-
'vLightSpecular0',
|
|
554
|
-
'vLightFalloff0',
|
|
555
|
-
'vSphericalL00',
|
|
556
|
-
'vSphericalL1_1',
|
|
557
|
-
'vSphericalL10',
|
|
558
|
-
'vSphericalL11',
|
|
559
|
-
'vSphericalL2_2',
|
|
560
|
-
'vSphericalL2_1',
|
|
561
|
-
'vSphericalL20',
|
|
562
|
-
'vSphericalL21',
|
|
563
|
-
'vSphericalL22',
|
|
564
|
-
'vAlbedoInfos',
|
|
565
|
-
'reflectionSampler',
|
|
566
|
-
]),
|
|
567
|
-
parsers: (_b = {},
|
|
568
|
-
_b[graph_types_1.NodeType.SOURCE] = {
|
|
569
|
-
manipulateAst: function (engineContext, engine, graph, ast, inputEdges, node, sibling) {
|
|
570
|
-
var programAst = ast;
|
|
571
|
-
var mainName = 'main' || (0, graph_1.nodeName)(node);
|
|
572
|
-
// This hinges on the vertex shader calling vec3(p)
|
|
573
|
-
if (node.stage === 'vertex') {
|
|
574
|
-
if ((0, graph_1.doesLinkThruShader)(graph, node)) {
|
|
575
|
-
(0, ast_1.returnGlPositionVec3Right)(mainName, programAst);
|
|
576
|
-
}
|
|
577
|
-
else {
|
|
578
|
-
(0, ast_1.returnGlPosition)(mainName, programAst);
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
return ast;
|
|
582
|
-
},
|
|
583
|
-
},
|
|
584
|
-
_b[engine_1.EngineNodeType.physical] = {
|
|
585
|
-
onBeforeCompile: function (graph, engineContext, node, sibling) {
|
|
586
|
-
return cacher(engineContext, graph, node, sibling, function () {
|
|
587
|
-
return onBeforeCompileMegaShader(engineContext, graph, node, sibling);
|
|
588
|
-
});
|
|
589
|
-
},
|
|
590
|
-
manipulateAst: megaShaderMainpulateAst,
|
|
591
|
-
},
|
|
592
|
-
_b),
|
|
593
|
-
};
|
|
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,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
var utils_1 = require("@shaderfrog/glsl-parser/parser/utils");
|
|
5
|
-
var engine_1 = require("../../engine");
|
|
6
|
-
var nodeInputMap = {
|
|
7
|
-
normalMap: 'bumpSampler',
|
|
8
|
-
property_map: 'property_albedoTexture',
|
|
9
|
-
property_normalMap: 'property_bumpTexture',
|
|
10
|
-
property_color: 'property_albedoColor',
|
|
11
|
-
property_metalness: 'property_metallic',
|
|
12
|
-
filler_position: 'filler_position',
|
|
13
|
-
};
|
|
14
|
-
var importers = {
|
|
15
|
-
three: {
|
|
16
|
-
// TODO: For hell:
|
|
17
|
-
// the renames below don't really work, the "seen" thing is confusing - I
|
|
18
|
-
// don't remember why I did that - is that to avoid renaming the original
|
|
19
|
-
// declaration? the original declaraitons need to be renamed or stripped
|
|
20
|
-
// from the original shader and the right imports added
|
|
21
|
-
//
|
|
22
|
-
// Also need to show babylon compile errors in the UI
|
|
23
|
-
convertAst: function (ast, type) {
|
|
24
|
-
// Babylon has no normalmatrix. They do have a normal attribute. So undo any
|
|
25
|
-
// multiplication by normalMatrix?
|
|
26
|
-
var seen = {};
|
|
27
|
-
(0, utils_1.renameBindings)(ast.scopes[0], function (name) {
|
|
28
|
-
// console.log({ name }, 'seen:', seen[name]);
|
|
29
|
-
var renamed = name === 'vUv'
|
|
30
|
-
? 'vMainUV1'
|
|
31
|
-
: name === 'vNormal'
|
|
32
|
-
? 'vNormalW'
|
|
33
|
-
: name === 'projectionMatrix'
|
|
34
|
-
? seen[name]
|
|
35
|
-
? 'viewProjection'
|
|
36
|
-
: 'hobgoblin'
|
|
37
|
-
: name === 'modelMatrix'
|
|
38
|
-
? seen[name]
|
|
39
|
-
? 'world'
|
|
40
|
-
: name
|
|
41
|
-
: name === 'modelViewMatrix'
|
|
42
|
-
? seen[name]
|
|
43
|
-
? '(world * viewProjection)'
|
|
44
|
-
: name
|
|
45
|
-
: name === 'vPosition'
|
|
46
|
-
? seen[name]
|
|
47
|
-
? 'vPositionW'
|
|
48
|
-
: name
|
|
49
|
-
: name;
|
|
50
|
-
seen[name] = true;
|
|
51
|
-
return renamed;
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
nodeInputMap: (_a = {},
|
|
55
|
-
_a[engine_1.EngineNodeType.physical] = nodeInputMap,
|
|
56
|
-
_a),
|
|
57
|
-
edgeMap: {
|
|
58
|
-
normalMap: 'bumpSampler',
|
|
59
|
-
property_map: 'property_albedoTexture',
|
|
60
|
-
property_normalMap: 'property_bumpTexture',
|
|
61
|
-
property_color: 'property_albedoColor',
|
|
62
|
-
property_metalness: 'property_metallic',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
exports.default = importers;
|
|
@@ -1,5 +0,0 @@
|
|
|
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; } });
|