babylonjs-serializers 6.6.1 → 6.8.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/babylon.glTF2Serializer.js +933 -1179
- package/babylon.glTF2Serializer.js.map +1 -1
- package/babylon.glTF2Serializer.min.js +1 -1
- package/babylon.glTF2Serializer.min.js.map +1 -1
- package/babylon.objSerializer.js +4 -4
- package/babylon.objSerializer.js.map +1 -1
- package/babylon.objSerializer.min.js.map +1 -1
- package/babylon.stlSerializer.js +4 -4
- package/babylon.stlSerializer.js.map +1 -1
- package/babylon.stlSerializer.min.js.map +1 -1
- package/babylonjs.serializers.d.ts +25 -128
- package/babylonjs.serializers.js +1009 -1255
- package/babylonjs.serializers.js.map +1 -1
- package/babylonjs.serializers.min.js +1 -1
- package/babylonjs.serializers.min.js.map +1 -1
- package/babylonjs.serializers.module.d.ts +51 -259
- package/package.json +3 -3
|
@@ -12,341 +12,6 @@ return /******/ (() => { // webpackBootstrap
|
|
|
12
12
|
/******/ "use strict";
|
|
13
13
|
/******/ var __webpack_modules__ = ({
|
|
14
14
|
|
|
15
|
-
/***/ "../../../../node_modules/tslib/tslib.es6.js":
|
|
16
|
-
/*!***************************************************!*\
|
|
17
|
-
!*** ../../../../node_modules/tslib/tslib.es6.js ***!
|
|
18
|
-
\***************************************************/
|
|
19
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20
|
-
|
|
21
|
-
__webpack_require__.r(__webpack_exports__);
|
|
22
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
23
|
-
/* harmony export */ "__assign": () => (/* binding */ __assign),
|
|
24
|
-
/* harmony export */ "__asyncDelegator": () => (/* binding */ __asyncDelegator),
|
|
25
|
-
/* harmony export */ "__asyncGenerator": () => (/* binding */ __asyncGenerator),
|
|
26
|
-
/* harmony export */ "__asyncValues": () => (/* binding */ __asyncValues),
|
|
27
|
-
/* harmony export */ "__await": () => (/* binding */ __await),
|
|
28
|
-
/* harmony export */ "__awaiter": () => (/* binding */ __awaiter),
|
|
29
|
-
/* harmony export */ "__classPrivateFieldGet": () => (/* binding */ __classPrivateFieldGet),
|
|
30
|
-
/* harmony export */ "__classPrivateFieldIn": () => (/* binding */ __classPrivateFieldIn),
|
|
31
|
-
/* harmony export */ "__classPrivateFieldSet": () => (/* binding */ __classPrivateFieldSet),
|
|
32
|
-
/* harmony export */ "__createBinding": () => (/* binding */ __createBinding),
|
|
33
|
-
/* harmony export */ "__decorate": () => (/* binding */ __decorate),
|
|
34
|
-
/* harmony export */ "__esDecorate": () => (/* binding */ __esDecorate),
|
|
35
|
-
/* harmony export */ "__exportStar": () => (/* binding */ __exportStar),
|
|
36
|
-
/* harmony export */ "__extends": () => (/* binding */ __extends),
|
|
37
|
-
/* harmony export */ "__generator": () => (/* binding */ __generator),
|
|
38
|
-
/* harmony export */ "__importDefault": () => (/* binding */ __importDefault),
|
|
39
|
-
/* harmony export */ "__importStar": () => (/* binding */ __importStar),
|
|
40
|
-
/* harmony export */ "__makeTemplateObject": () => (/* binding */ __makeTemplateObject),
|
|
41
|
-
/* harmony export */ "__metadata": () => (/* binding */ __metadata),
|
|
42
|
-
/* harmony export */ "__param": () => (/* binding */ __param),
|
|
43
|
-
/* harmony export */ "__propKey": () => (/* binding */ __propKey),
|
|
44
|
-
/* harmony export */ "__read": () => (/* binding */ __read),
|
|
45
|
-
/* harmony export */ "__rest": () => (/* binding */ __rest),
|
|
46
|
-
/* harmony export */ "__runInitializers": () => (/* binding */ __runInitializers),
|
|
47
|
-
/* harmony export */ "__setFunctionName": () => (/* binding */ __setFunctionName),
|
|
48
|
-
/* harmony export */ "__spread": () => (/* binding */ __spread),
|
|
49
|
-
/* harmony export */ "__spreadArray": () => (/* binding */ __spreadArray),
|
|
50
|
-
/* harmony export */ "__spreadArrays": () => (/* binding */ __spreadArrays),
|
|
51
|
-
/* harmony export */ "__values": () => (/* binding */ __values)
|
|
52
|
-
/* harmony export */ });
|
|
53
|
-
/******************************************************************************
|
|
54
|
-
Copyright (c) Microsoft Corporation.
|
|
55
|
-
|
|
56
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
57
|
-
purpose with or without fee is hereby granted.
|
|
58
|
-
|
|
59
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
60
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
61
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
62
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
63
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
64
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
65
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
66
|
-
***************************************************************************** */
|
|
67
|
-
/* global Reflect, Promise */
|
|
68
|
-
|
|
69
|
-
var extendStatics = function(d, b) {
|
|
70
|
-
extendStatics = Object.setPrototypeOf ||
|
|
71
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
72
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
73
|
-
return extendStatics(d, b);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
function __extends(d, b) {
|
|
77
|
-
if (typeof b !== "function" && b !== null)
|
|
78
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
79
|
-
extendStatics(d, b);
|
|
80
|
-
function __() { this.constructor = d; }
|
|
81
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
var __assign = function() {
|
|
85
|
-
__assign = Object.assign || function __assign(t) {
|
|
86
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
87
|
-
s = arguments[i];
|
|
88
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
89
|
-
}
|
|
90
|
-
return t;
|
|
91
|
-
}
|
|
92
|
-
return __assign.apply(this, arguments);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function __rest(s, e) {
|
|
96
|
-
var t = {};
|
|
97
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
98
|
-
t[p] = s[p];
|
|
99
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
100
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
101
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
102
|
-
t[p[i]] = s[p[i]];
|
|
103
|
-
}
|
|
104
|
-
return t;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function __decorate(decorators, target, key, desc) {
|
|
108
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
109
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
110
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
111
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function __param(paramIndex, decorator) {
|
|
115
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
119
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
120
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
121
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
122
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
123
|
-
var _, done = false;
|
|
124
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
125
|
-
var context = {};
|
|
126
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
127
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
128
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
129
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
130
|
-
if (kind === "accessor") {
|
|
131
|
-
if (result === void 0) continue;
|
|
132
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
133
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
134
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
135
|
-
if (_ = accept(result.init)) initializers.push(_);
|
|
136
|
-
}
|
|
137
|
-
else if (_ = accept(result)) {
|
|
138
|
-
if (kind === "field") initializers.push(_);
|
|
139
|
-
else descriptor[key] = _;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
143
|
-
done = true;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
function __runInitializers(thisArg, initializers, value) {
|
|
147
|
-
var useValue = arguments.length > 2;
|
|
148
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
149
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
150
|
-
}
|
|
151
|
-
return useValue ? value : void 0;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
function __propKey(x) {
|
|
155
|
-
return typeof x === "symbol" ? x : "".concat(x);
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
function __setFunctionName(f, name, prefix) {
|
|
159
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
160
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
function __metadata(metadataKey, metadataValue) {
|
|
164
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
168
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
169
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
170
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
171
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
172
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
173
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function __generator(thisArg, body) {
|
|
178
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
179
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
180
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
181
|
-
function step(op) {
|
|
182
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
183
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
184
|
-
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;
|
|
185
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
186
|
-
switch (op[0]) {
|
|
187
|
-
case 0: case 1: t = op; break;
|
|
188
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
189
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
190
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
191
|
-
default:
|
|
192
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
193
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
194
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
195
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
196
|
-
if (t[2]) _.ops.pop();
|
|
197
|
-
_.trys.pop(); continue;
|
|
198
|
-
}
|
|
199
|
-
op = body.call(thisArg, _);
|
|
200
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
201
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
206
|
-
if (k2 === undefined) k2 = k;
|
|
207
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
208
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
209
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
210
|
-
}
|
|
211
|
-
Object.defineProperty(o, k2, desc);
|
|
212
|
-
}) : (function(o, m, k, k2) {
|
|
213
|
-
if (k2 === undefined) k2 = k;
|
|
214
|
-
o[k2] = m[k];
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
function __exportStar(m, o) {
|
|
218
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function __values(o) {
|
|
222
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
223
|
-
if (m) return m.call(o);
|
|
224
|
-
if (o && typeof o.length === "number") return {
|
|
225
|
-
next: function () {
|
|
226
|
-
if (o && i >= o.length) o = void 0;
|
|
227
|
-
return { value: o && o[i++], done: !o };
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function __read(o, n) {
|
|
234
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
235
|
-
if (!m) return o;
|
|
236
|
-
var i = m.call(o), r, ar = [], e;
|
|
237
|
-
try {
|
|
238
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
239
|
-
}
|
|
240
|
-
catch (error) { e = { error: error }; }
|
|
241
|
-
finally {
|
|
242
|
-
try {
|
|
243
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
244
|
-
}
|
|
245
|
-
finally { if (e) throw e.error; }
|
|
246
|
-
}
|
|
247
|
-
return ar;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/** @deprecated */
|
|
251
|
-
function __spread() {
|
|
252
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
253
|
-
ar = ar.concat(__read(arguments[i]));
|
|
254
|
-
return ar;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/** @deprecated */
|
|
258
|
-
function __spreadArrays() {
|
|
259
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
260
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
261
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
262
|
-
r[k] = a[j];
|
|
263
|
-
return r;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
function __spreadArray(to, from, pack) {
|
|
267
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
268
|
-
if (ar || !(i in from)) {
|
|
269
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
270
|
-
ar[i] = from[i];
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function __await(v) {
|
|
277
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
281
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
282
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
283
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
284
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
285
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
286
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
287
|
-
function fulfill(value) { resume("next", value); }
|
|
288
|
-
function reject(value) { resume("throw", value); }
|
|
289
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function __asyncDelegator(o) {
|
|
293
|
-
var i, p;
|
|
294
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
295
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
function __asyncValues(o) {
|
|
299
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
300
|
-
var m = o[Symbol.asyncIterator], i;
|
|
301
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
302
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
303
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
function __makeTemplateObject(cooked, raw) {
|
|
307
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
308
|
-
return cooked;
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
312
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
313
|
-
}) : function(o, v) {
|
|
314
|
-
o["default"] = v;
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
function __importStar(mod) {
|
|
318
|
-
if (mod && mod.__esModule) return mod;
|
|
319
|
-
var result = {};
|
|
320
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
321
|
-
__setModuleDefault(result, mod);
|
|
322
|
-
return result;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function __importDefault(mod) {
|
|
326
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
330
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
331
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
332
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
336
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
337
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
338
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
339
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function __classPrivateFieldIn(state, receiver) {
|
|
343
|
-
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
|
344
|
-
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
/***/ }),
|
|
349
|
-
|
|
350
15
|
/***/ "../../../lts/serializers/dist/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js":
|
|
351
16
|
/*!************************************************************************************!*\
|
|
352
17
|
!*** ../../../lts/serializers/dist/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js ***!
|
|
@@ -355,7 +20,7 @@ function __classPrivateFieldIn(state, receiver) {
|
|
|
355
20
|
|
|
356
21
|
__webpack_require__.r(__webpack_exports__);
|
|
357
22
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
358
|
-
/* harmony export */
|
|
23
|
+
/* harmony export */ EXT_mesh_gpu_instancing: () => (/* binding */ EXT_mesh_gpu_instancing)
|
|
359
24
|
/* harmony export */ });
|
|
360
25
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
361
26
|
/* harmony import */ var core_Meshes_mesh__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Buffers/buffer */ "core/Maths/math.vector");
|
|
@@ -505,14 +170,11 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, fun
|
|
|
505
170
|
|
|
506
171
|
__webpack_require__.r(__webpack_exports__);
|
|
507
172
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
508
|
-
/* harmony export */
|
|
173
|
+
/* harmony export */ KHR_lights_punctual: () => (/* binding */ KHR_lights_punctual)
|
|
509
174
|
/* harmony export */ });
|
|
510
175
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/logger */ "core/Maths/math.vector");
|
|
511
176
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
512
177
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
513
|
-
/* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../glTFUtilities */ "../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js");
|
|
514
|
-
|
|
515
|
-
|
|
516
178
|
|
|
517
179
|
|
|
518
180
|
|
|
@@ -565,57 +227,48 @@ var KHR_lights_punctual = /** @class */ (function () {
|
|
|
565
227
|
var _this = this;
|
|
566
228
|
return new Promise(function (resolve) {
|
|
567
229
|
if (node && babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.ShadowLight) {
|
|
568
|
-
var babylonLight = babylonNode;
|
|
569
230
|
var light = void 0;
|
|
570
|
-
var lightType =
|
|
231
|
+
var lightType = babylonNode.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_POINTLIGHT
|
|
571
232
|
? "point" /* KHRLightsPunctual_LightType.POINT */
|
|
572
|
-
:
|
|
233
|
+
: babylonNode.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_DIRECTIONALLIGHT
|
|
573
234
|
? "directional" /* KHRLightsPunctual_LightType.DIRECTIONAL */
|
|
574
|
-
:
|
|
235
|
+
: babylonNode.getTypeID() == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.LIGHTTYPEID_SPOTLIGHT
|
|
575
236
|
? "spot" /* KHRLightsPunctual_LightType.SPOT */
|
|
576
237
|
: null;
|
|
577
238
|
if (lightType == null) {
|
|
578
|
-
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light ").concat(
|
|
239
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light ").concat(babylonNode.name, " is not supported in ").concat(NAME));
|
|
579
240
|
}
|
|
580
241
|
else {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
if (!lightPosition.equals(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero())) {
|
|
584
|
-
if (convertToRightHandedSystem) {
|
|
585
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._GetRightHandedPositionVector3FromRef(lightPosition);
|
|
586
|
-
}
|
|
587
|
-
node.translation = lightPosition.asArray();
|
|
242
|
+
if (!babylonNode.position.equalsToFloats(0, 0, 0)) {
|
|
243
|
+
node.translation = babylonNode.position.asArray();
|
|
588
244
|
}
|
|
589
245
|
if (lightType !== "point" /* KHRLightsPunctual_LightType.POINT */) {
|
|
590
|
-
var localAxis =
|
|
591
|
-
var yaw = -Math.atan2(localAxis.z
|
|
246
|
+
var localAxis = babylonNode.direction;
|
|
247
|
+
var yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;
|
|
592
248
|
var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
|
|
593
249
|
var pitch = -Math.atan2(localAxis.y, len);
|
|
594
|
-
var lightRotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(yaw, pitch, 0);
|
|
595
|
-
if (
|
|
596
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._GetRightHandedQuaternionFromRef(lightRotationQuaternion);
|
|
597
|
-
}
|
|
598
|
-
if (!lightRotationQuaternion.equals(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity())) {
|
|
250
|
+
var lightRotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(yaw + Math.PI, pitch, 0);
|
|
251
|
+
if (!core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(lightRotationQuaternion)) {
|
|
599
252
|
node.rotation = lightRotationQuaternion.asArray();
|
|
600
253
|
}
|
|
601
254
|
}
|
|
602
|
-
if (
|
|
603
|
-
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light falloff for ").concat(
|
|
255
|
+
if (babylonNode.falloffType !== core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Light.FALLOFF_GLTF) {
|
|
256
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Logger.Warn("".concat(context, ": Light falloff for ").concat(babylonNode.name, " does not match the ").concat(NAME, " specification!"));
|
|
604
257
|
}
|
|
605
258
|
light = {
|
|
606
259
|
type: lightType,
|
|
607
260
|
};
|
|
608
|
-
if (!
|
|
609
|
-
light.color =
|
|
261
|
+
if (!babylonNode.diffuse.equals(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White())) {
|
|
262
|
+
light.color = babylonNode.diffuse.asArray();
|
|
610
263
|
}
|
|
611
|
-
if (
|
|
612
|
-
light.intensity =
|
|
264
|
+
if (babylonNode.intensity !== 1.0) {
|
|
265
|
+
light.intensity = babylonNode.intensity;
|
|
613
266
|
}
|
|
614
|
-
if (
|
|
615
|
-
light.range =
|
|
267
|
+
if (babylonNode.range !== Number.MAX_VALUE) {
|
|
268
|
+
light.range = babylonNode.range;
|
|
616
269
|
}
|
|
617
270
|
if (lightType === "spot" /* KHRLightsPunctual_LightType.SPOT */) {
|
|
618
|
-
var babylonSpotLight =
|
|
271
|
+
var babylonSpotLight = babylonNode;
|
|
619
272
|
if (babylonSpotLight.angle !== Math.PI / 2.0) {
|
|
620
273
|
if (light.spot == null) {
|
|
621
274
|
light.spot = {};
|
|
@@ -629,11 +282,9 @@ var KHR_lights_punctual = /** @class */ (function () {
|
|
|
629
282
|
light.spot.innerConeAngle = babylonSpotLight.innerAngle / 2.0;
|
|
630
283
|
}
|
|
631
284
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
};
|
|
636
|
-
}
|
|
285
|
+
_this._lights || (_this._lights = {
|
|
286
|
+
lights: [],
|
|
287
|
+
});
|
|
637
288
|
_this._lights.lights.push(light);
|
|
638
289
|
var lightReference = {
|
|
639
290
|
light: _this._lights.lights.length - 1,
|
|
@@ -643,52 +294,41 @@ var KHR_lights_punctual = /** @class */ (function () {
|
|
|
643
294
|
if (parentBabylonNode && parentBabylonNode.getChildren().length == 1) {
|
|
644
295
|
var parentNode = _this._exporter._nodes[nodeMap[parentBabylonNode.uniqueId]];
|
|
645
296
|
if (parentNode) {
|
|
646
|
-
var
|
|
647
|
-
var
|
|
648
|
-
var
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
var
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
if (
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
297
|
+
var parentTranslation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(parentNode.translation || [0, 0, 0], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[0]);
|
|
298
|
+
var parentRotation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArrayToRef(parentNode.rotation || [0, 0, 0, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[0]);
|
|
299
|
+
var parentScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(parentNode.scale || [1, 1, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[1]);
|
|
300
|
+
var parentMatrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(parentScale, parentRotation, parentTranslation, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[0]);
|
|
301
|
+
var translation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(node.translation || [0, 0, 0], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[2]);
|
|
302
|
+
var rotation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArrayToRef(node.rotation || [0, 0, 0, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[1]);
|
|
303
|
+
var matrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.OneReadOnly, rotation, translation, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[1]);
|
|
304
|
+
parentMatrix.multiplyToRef(matrix, matrix);
|
|
305
|
+
matrix.decompose(parentScale, parentRotation, parentTranslation);
|
|
306
|
+
if (parentTranslation.equalsToFloats(0, 0, 0)) {
|
|
307
|
+
delete parentNode.translation;
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
parentNode.translation = parentTranslation.asArray();
|
|
311
|
+
}
|
|
312
|
+
if (core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(parentRotation)) {
|
|
313
|
+
delete parentNode.rotation;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
parentNode.rotation = parentRotation.asArray();
|
|
665
317
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
nodeLocalRotation.multiplyInPlace(new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion(node.rotation[0], node.rotation[1], node.rotation[2], node.rotation[3]));
|
|
318
|
+
if (parentScale.equalsToFloats(1, 1, 1)) {
|
|
319
|
+
delete parentNode.scale;
|
|
669
320
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
lightLocalMatrix.multiplyToRef(parentInvertNodeLocalMatrix, lightLocalMatrix);
|
|
673
|
-
var parentNewScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[0];
|
|
674
|
-
var parentNewRotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[0];
|
|
675
|
-
var parentNewTranslation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[1];
|
|
676
|
-
lightLocalMatrix.decompose(parentNewScale, parentNewRotationQuaternion, parentNewTranslation);
|
|
677
|
-
parentNode.scale = parentNewScale.asArray();
|
|
678
|
-
parentNode.rotation = parentNewRotationQuaternion.asArray();
|
|
679
|
-
parentNode.translation = parentNewTranslation.asArray();
|
|
680
|
-
if (parentNode.extensions == null) {
|
|
681
|
-
parentNode.extensions = {};
|
|
321
|
+
else {
|
|
322
|
+
parentNode.scale = parentScale.asArray();
|
|
682
323
|
}
|
|
324
|
+
parentNode.extensions || (parentNode.extensions = {});
|
|
683
325
|
parentNode.extensions[NAME] = lightReference;
|
|
684
326
|
// Do not export the original node
|
|
685
327
|
resolve(null);
|
|
686
328
|
return;
|
|
687
329
|
}
|
|
688
330
|
}
|
|
689
|
-
|
|
690
|
-
node.extensions = {};
|
|
691
|
-
}
|
|
331
|
+
node.extensions || (node.extensions = {});
|
|
692
332
|
node.extensions[NAME] = lightReference;
|
|
693
333
|
}
|
|
694
334
|
}
|
|
@@ -711,7 +351,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_1__._Exporter.RegisterExtension(NAME, fun
|
|
|
711
351
|
|
|
712
352
|
__webpack_require__.r(__webpack_exports__);
|
|
713
353
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
714
|
-
/* harmony export */
|
|
354
|
+
/* harmony export */ KHR_materials_anisotropy: () => (/* binding */ KHR_materials_anisotropy)
|
|
715
355
|
/* harmony export */ });
|
|
716
356
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
717
357
|
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrBaseMaterial */ "core/Maths/math.vector");
|
|
@@ -795,7 +435,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, fun
|
|
|
795
435
|
|
|
796
436
|
__webpack_require__.r(__webpack_exports__);
|
|
797
437
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
798
|
-
/* harmony export */
|
|
438
|
+
/* harmony export */ KHR_materials_clearcoat: () => (/* binding */ KHR_materials_clearcoat)
|
|
799
439
|
/* harmony export */ });
|
|
800
440
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
801
441
|
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/tools */ "core/Maths/math.vector");
|
|
@@ -902,7 +542,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, fun
|
|
|
902
542
|
|
|
903
543
|
__webpack_require__.r(__webpack_exports__);
|
|
904
544
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
905
|
-
/* harmony export */
|
|
545
|
+
/* harmony export */ KHR_materials_emissive_strength: () => (/* binding */ KHR_materials_emissive_strength)
|
|
906
546
|
/* harmony export */ });
|
|
907
547
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
908
548
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Maths/math.vector");
|
|
@@ -971,7 +611,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, fun
|
|
|
971
611
|
|
|
972
612
|
__webpack_require__.r(__webpack_exports__);
|
|
973
613
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
974
|
-
/* harmony export */
|
|
614
|
+
/* harmony export */ KHR_materials_ior: () => (/* binding */ KHR_materials_ior)
|
|
975
615
|
/* harmony export */ });
|
|
976
616
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
977
617
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Maths/math.vector");
|
|
@@ -1040,7 +680,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, fun
|
|
|
1040
680
|
|
|
1041
681
|
__webpack_require__.r(__webpack_exports__);
|
|
1042
682
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1043
|
-
/* harmony export */
|
|
683
|
+
/* harmony export */ KHR_materials_iridescence: () => (/* binding */ KHR_materials_iridescence)
|
|
1044
684
|
/* harmony export */ });
|
|
1045
685
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1046
686
|
/* harmony import */ var core_Materials_PBR_pbrBaseMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrBaseMaterial */ "core/Maths/math.vector");
|
|
@@ -1131,7 +771,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, fun
|
|
|
1131
771
|
|
|
1132
772
|
__webpack_require__.r(__webpack_exports__);
|
|
1133
773
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1134
|
-
/* harmony export */
|
|
774
|
+
/* harmony export */ KHR_materials_sheen: () => (/* binding */ KHR_materials_sheen)
|
|
1135
775
|
/* harmony export */ });
|
|
1136
776
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1137
777
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Maths/math.vector");
|
|
@@ -1221,7 +861,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, fun
|
|
|
1221
861
|
|
|
1222
862
|
__webpack_require__.r(__webpack_exports__);
|
|
1223
863
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1224
|
-
/* harmony export */
|
|
864
|
+
/* harmony export */ KHR_materials_specular: () => (/* binding */ KHR_materials_specular)
|
|
1225
865
|
/* harmony export */ });
|
|
1226
866
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1227
867
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Maths/math.vector");
|
|
@@ -1323,7 +963,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, fun
|
|
|
1323
963
|
|
|
1324
964
|
__webpack_require__.r(__webpack_exports__);
|
|
1325
965
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1326
|
-
/* harmony export */
|
|
966
|
+
/* harmony export */ KHR_materials_transmission: () => (/* binding */ KHR_materials_transmission)
|
|
1327
967
|
/* harmony export */ });
|
|
1328
968
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1329
969
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/PBR/pbrMaterial */ "core/Maths/math.vector");
|
|
@@ -1416,7 +1056,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, fun
|
|
|
1416
1056
|
|
|
1417
1057
|
__webpack_require__.r(__webpack_exports__);
|
|
1418
1058
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1419
|
-
/* harmony export */
|
|
1059
|
+
/* harmony export */ KHR_materials_unlit: () => (/* binding */ KHR_materials_unlit)
|
|
1420
1060
|
/* harmony export */ });
|
|
1421
1061
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1422
1062
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Materials/standardMaterial */ "core/Maths/math.vector");
|
|
@@ -1484,7 +1124,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, fun
|
|
|
1484
1124
|
|
|
1485
1125
|
__webpack_require__.r(__webpack_exports__);
|
|
1486
1126
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1487
|
-
/* harmony export */
|
|
1127
|
+
/* harmony export */ KHR_materials_volume: () => (/* binding */ KHR_materials_volume)
|
|
1488
1128
|
/* harmony export */ });
|
|
1489
1129
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
1490
1130
|
/* harmony import */ var core_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Maths/math.color */ "core/Maths/math.vector");
|
|
@@ -1589,7 +1229,7 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_0__._Exporter.RegisterExtension(NAME, fun
|
|
|
1589
1229
|
|
|
1590
1230
|
__webpack_require__.r(__webpack_exports__);
|
|
1591
1231
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1592
|
-
/* harmony export */
|
|
1232
|
+
/* harmony export */ KHR_texture_transform: () => (/* binding */ KHR_texture_transform)
|
|
1593
1233
|
/* harmony export */ });
|
|
1594
1234
|
/* harmony import */ var core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/tools */ "core/Maths/math.vector");
|
|
1595
1235
|
/* harmony import */ var core_Misc_tools__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Misc_tools__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -1694,19 +1334,19 @@ _glTFExporter__WEBPACK_IMPORTED_MODULE_1__._Exporter.RegisterExtension(NAME, fun
|
|
|
1694
1334
|
|
|
1695
1335
|
__webpack_require__.r(__webpack_exports__);
|
|
1696
1336
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1697
|
-
/* harmony export */
|
|
1698
|
-
/* harmony export */
|
|
1699
|
-
/* harmony export */
|
|
1700
|
-
/* harmony export */
|
|
1701
|
-
/* harmony export */
|
|
1702
|
-
/* harmony export */
|
|
1703
|
-
/* harmony export */
|
|
1704
|
-
/* harmony export */
|
|
1705
|
-
/* harmony export */
|
|
1706
|
-
/* harmony export */
|
|
1707
|
-
/* harmony export */
|
|
1708
|
-
/* harmony export */
|
|
1709
|
-
/* harmony export */
|
|
1337
|
+
/* harmony export */ EXT_mesh_gpu_instancing: () => (/* reexport safe */ _EXT_mesh_gpu_instancing__WEBPACK_IMPORTED_MODULE_11__.EXT_mesh_gpu_instancing),
|
|
1338
|
+
/* harmony export */ KHR_lights_punctual: () => (/* reexport safe */ _KHR_lights_punctual__WEBPACK_IMPORTED_MODULE_1__.KHR_lights_punctual),
|
|
1339
|
+
/* harmony export */ KHR_materials_anisotropy: () => (/* reexport safe */ _KHR_materials_anisotropy__WEBPACK_IMPORTED_MODULE_4__.KHR_materials_anisotropy),
|
|
1340
|
+
/* harmony export */ KHR_materials_clearcoat: () => (/* reexport safe */ _KHR_materials_clearcoat__WEBPACK_IMPORTED_MODULE_2__.KHR_materials_clearcoat),
|
|
1341
|
+
/* harmony export */ KHR_materials_emissive_strength: () => (/* reexport safe */ _KHR_materials_emissive_strength__WEBPACK_IMPORTED_MODULE_12__.KHR_materials_emissive_strength),
|
|
1342
|
+
/* harmony export */ KHR_materials_ior: () => (/* reexport safe */ _KHR_materials_ior__WEBPACK_IMPORTED_MODULE_7__.KHR_materials_ior),
|
|
1343
|
+
/* harmony export */ KHR_materials_iridescence: () => (/* reexport safe */ _KHR_materials_iridescence__WEBPACK_IMPORTED_MODULE_3__.KHR_materials_iridescence),
|
|
1344
|
+
/* harmony export */ KHR_materials_sheen: () => (/* reexport safe */ _KHR_materials_sheen__WEBPACK_IMPORTED_MODULE_5__.KHR_materials_sheen),
|
|
1345
|
+
/* harmony export */ KHR_materials_specular: () => (/* reexport safe */ _KHR_materials_specular__WEBPACK_IMPORTED_MODULE_8__.KHR_materials_specular),
|
|
1346
|
+
/* harmony export */ KHR_materials_transmission: () => (/* reexport safe */ _KHR_materials_transmission__WEBPACK_IMPORTED_MODULE_10__.KHR_materials_transmission),
|
|
1347
|
+
/* harmony export */ KHR_materials_unlit: () => (/* reexport safe */ _KHR_materials_unlit__WEBPACK_IMPORTED_MODULE_6__.KHR_materials_unlit),
|
|
1348
|
+
/* harmony export */ KHR_materials_volume: () => (/* reexport safe */ _KHR_materials_volume__WEBPACK_IMPORTED_MODULE_9__.KHR_materials_volume),
|
|
1349
|
+
/* harmony export */ KHR_texture_transform: () => (/* reexport safe */ _KHR_texture_transform__WEBPACK_IMPORTED_MODULE_0__.KHR_texture_transform)
|
|
1710
1350
|
/* harmony export */ });
|
|
1711
1351
|
/* harmony import */ var _KHR_texture_transform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./KHR_texture_transform */ "../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_texture_transform.js");
|
|
1712
1352
|
/* harmony import */ var _KHR_lights_punctual__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./KHR_lights_punctual */ "../../../lts/serializers/dist/glTF/2.0/Extensions/KHR_lights_punctual.js");
|
|
@@ -1746,7 +1386,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1746
1386
|
|
|
1747
1387
|
__webpack_require__.r(__webpack_exports__);
|
|
1748
1388
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1749
|
-
/* harmony export */
|
|
1389
|
+
/* harmony export */ _GLTFAnimation: () => (/* binding */ _GLTFAnimation)
|
|
1750
1390
|
/* harmony export */ });
|
|
1751
1391
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Lights/light */ "core/Maths/math.vector");
|
|
1752
1392
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -1799,32 +1439,30 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
1799
1439
|
* @param babylonTransformNode - BabylonJS mesh.
|
|
1800
1440
|
* @param animation - animation.
|
|
1801
1441
|
* @param animationChannelTargetPath - The target animation channel.
|
|
1802
|
-
* @param convertToRightHandedSystem - Specifies if the values should be converted to right-handed.
|
|
1803
1442
|
* @param useQuaternion - Specifies if quaternions are used.
|
|
1804
1443
|
* @returns nullable IAnimationData
|
|
1805
1444
|
*/
|
|
1806
|
-
_GLTFAnimation._CreateNodeAnimation = function (babylonTransformNode, animation, animationChannelTargetPath,
|
|
1445
|
+
_GLTFAnimation._CreateNodeAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, useQuaternion, animationSampleRate) {
|
|
1807
1446
|
if (this._IsTransformable(babylonTransformNode)) {
|
|
1808
1447
|
var inputs = [];
|
|
1809
1448
|
var outputs = [];
|
|
1810
1449
|
var keyFrames = animation.getKeys();
|
|
1811
1450
|
var minMaxKeyFrames = _GLTFAnimation._CalculateMinMaxKeyFrames(keyFrames);
|
|
1812
1451
|
var interpolationOrBake = _GLTFAnimation._DeduceInterpolation(keyFrames, animationChannelTargetPath, useQuaternion);
|
|
1813
|
-
var frameDelta = minMaxKeyFrames.max - minMaxKeyFrames.min;
|
|
1814
1452
|
var interpolation = interpolationOrBake.interpolationType;
|
|
1815
1453
|
var shouldBakeAnimation = interpolationOrBake.shouldBakeAnimation;
|
|
1816
1454
|
if (shouldBakeAnimation) {
|
|
1817
|
-
_GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames,
|
|
1455
|
+
_GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, useQuaternion);
|
|
1818
1456
|
}
|
|
1819
1457
|
else {
|
|
1820
1458
|
if (interpolation === "LINEAR" /* AnimationSamplerInterpolation.LINEAR */ || interpolation === "STEP" /* AnimationSamplerInterpolation.STEP */) {
|
|
1821
|
-
_GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath,
|
|
1459
|
+
_GLTFAnimation._CreateLinearOrStepAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);
|
|
1822
1460
|
}
|
|
1823
1461
|
else if (interpolation === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */) {
|
|
1824
|
-
_GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath,
|
|
1462
|
+
_GLTFAnimation._CreateCubicSplineAnimation(babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion);
|
|
1825
1463
|
}
|
|
1826
1464
|
else {
|
|
1827
|
-
_GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames,
|
|
1465
|
+
_GLTFAnimation._CreateBakedAnimation(babylonTransformNode, animation, animationChannelTargetPath, minMaxKeyFrames.min, minMaxKeyFrames.max, animation.framePerSecond, animationSampleRate, inputs, outputs, minMaxKeyFrames, useQuaternion);
|
|
1828
1466
|
}
|
|
1829
1467
|
}
|
|
1830
1468
|
if (inputs.length && outputs.length) {
|
|
@@ -1893,10 +1531,9 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
1893
1531
|
* @param binaryWriter
|
|
1894
1532
|
* @param bufferViews
|
|
1895
1533
|
* @param accessors
|
|
1896
|
-
* @param convertToRightHandedSystem
|
|
1897
1534
|
* @param animationSampleRate
|
|
1898
1535
|
*/
|
|
1899
|
-
_GLTFAnimation._CreateNodeAnimationFromNodeAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors,
|
|
1536
|
+
_GLTFAnimation._CreateNodeAnimationFromNodeAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
|
|
1900
1537
|
var glTFAnimation;
|
|
1901
1538
|
if (_GLTFAnimation._IsTransformable(babylonNode)) {
|
|
1902
1539
|
if (babylonNode.animations) {
|
|
@@ -1912,7 +1549,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
1912
1549
|
samplers: [],
|
|
1913
1550
|
channels: [],
|
|
1914
1551
|
};
|
|
1915
|
-
_GLTFAnimation._AddAnimation("".concat(animation.name), animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors,
|
|
1552
|
+
_GLTFAnimation._AddAnimation("".concat(animation.name), animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate);
|
|
1916
1553
|
if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {
|
|
1917
1554
|
idleGLTFAnimations.push(glTFAnimation);
|
|
1918
1555
|
}
|
|
@@ -1932,10 +1569,9 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
1932
1569
|
* @param binaryWriter
|
|
1933
1570
|
* @param bufferViews
|
|
1934
1571
|
* @param accessors
|
|
1935
|
-
* @param convertToRightHandedSystem
|
|
1936
1572
|
* @param animationSampleRate
|
|
1937
1573
|
*/
|
|
1938
|
-
_GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors,
|
|
1574
|
+
_GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations = function (babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, nodes, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
|
|
1939
1575
|
var glTFAnimation;
|
|
1940
1576
|
if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
|
|
1941
1577
|
var morphTargetManager = babylonNode.morphTargetManager;
|
|
@@ -1969,7 +1605,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
1969
1605
|
samplers: [],
|
|
1970
1606
|
channels: [],
|
|
1971
1607
|
};
|
|
1972
|
-
_GLTFAnimation._AddAnimation(animation.name, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, combinedAnimation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors,
|
|
1608
|
+
_GLTFAnimation._AddAnimation(animation.name, animation.hasRunningRuntimeAnimations ? runtimeGLTFAnimation : glTFAnimation, babylonNode, combinedAnimation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, morphTargetManager.numTargets);
|
|
1973
1609
|
if (glTFAnimation.samplers.length && glTFAnimation.channels.length) {
|
|
1974
1610
|
idleGLTFAnimations.push(glTFAnimation);
|
|
1975
1611
|
}
|
|
@@ -1989,10 +1625,9 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
1989
1625
|
* @param binaryWriter
|
|
1990
1626
|
* @param bufferViews
|
|
1991
1627
|
* @param accessors
|
|
1992
|
-
* @param convertToRightHandedSystemMap
|
|
1993
1628
|
* @param animationSampleRate
|
|
1994
1629
|
*/
|
|
1995
|
-
_GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups = function (babylonScene, glTFAnimations, nodeMap,
|
|
1630
|
+
_GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups = function (babylonScene, glTFAnimations, nodeMap, binaryWriter, bufferViews, accessors, animationSampleRate, shouldExportAnimation) {
|
|
1996
1631
|
var _a;
|
|
1997
1632
|
var glTFAnimation;
|
|
1998
1633
|
if (babylonScene.animationGroups) {
|
|
@@ -2019,8 +1654,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2019
1654
|
if (animationInfo) {
|
|
2020
1655
|
var babylonTransformNode = this_1._IsTransformable(target) ? target : this_1._IsTransformable(target[0]) ? target[0] : null;
|
|
2021
1656
|
if (babylonTransformNode) {
|
|
2022
|
-
|
|
2023
|
-
_GLTFAnimation._AddAnimation("".concat(animation.name), glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, convertToRightHandedSystem, animationInfo.useQuaternion, animationSampleRate);
|
|
1657
|
+
_GLTFAnimation._AddAnimation("".concat(animation.name), glTFAnimation, babylonTransformNode, animation, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate);
|
|
2024
1658
|
}
|
|
2025
1659
|
}
|
|
2026
1660
|
}
|
|
@@ -2102,7 +1736,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2102
1736
|
combinedAnimationGroup.setKeys(animationKeys);
|
|
2103
1737
|
var animationInfo = _GLTFAnimation._DeduceAnimationInfo(combinedAnimationGroup);
|
|
2104
1738
|
if (animationInfo) {
|
|
2105
|
-
_GLTFAnimation._AddAnimation("".concat(animationGroup.name, "_").concat(mesh.name, "_MorphWeightAnimation"), glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors,
|
|
1739
|
+
_GLTFAnimation._AddAnimation("".concat(animationGroup.name, "_").concat(mesh.name, "_MorphWeightAnimation"), glTFAnimation, mesh, combinedAnimationGroup, animationInfo.dataAccessorType, animationInfo.animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, animationInfo.useQuaternion, animationSampleRate, morphTargetManager === null || morphTargetManager === void 0 ? void 0 : morphTargetManager.numTargets);
|
|
2106
1740
|
}
|
|
2107
1741
|
});
|
|
2108
1742
|
if (glTFAnimation.channels.length && glTFAnimation.samplers.length) {
|
|
@@ -2116,8 +1750,8 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2116
1750
|
}
|
|
2117
1751
|
}
|
|
2118
1752
|
};
|
|
2119
|
-
_GLTFAnimation._AddAnimation = function (name, glTFAnimation, babylonTransformNode, animation, dataAccessorType, animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors,
|
|
2120
|
-
var animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath,
|
|
1753
|
+
_GLTFAnimation._AddAnimation = function (name, glTFAnimation, babylonTransformNode, animation, dataAccessorType, animationChannelTargetPath, nodeMap, binaryWriter, bufferViews, accessors, useQuaternion, animationSampleRate, morphAnimationChannels) {
|
|
1754
|
+
var animationData = _GLTFAnimation._CreateNodeAnimation(babylonTransformNode, animation, animationChannelTargetPath, useQuaternion, animationSampleRate);
|
|
2121
1755
|
var bufferView;
|
|
2122
1756
|
var accessor;
|
|
2123
1757
|
var keyframeAccessorIndex;
|
|
@@ -2201,10 +1835,9 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2201
1835
|
* @param minMaxFrames
|
|
2202
1836
|
* @param minMaxFrames.min
|
|
2203
1837
|
* @param minMaxFrames.max
|
|
2204
|
-
* @param convertToRightHandedSystem converts the values to right-handed
|
|
2205
1838
|
* @param useQuaternion specifies if quaternions should be used
|
|
2206
1839
|
*/
|
|
2207
|
-
_GLTFAnimation._CreateBakedAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, minFrame, maxFrame, fps, sampleRate, inputs, outputs, minMaxFrames,
|
|
1840
|
+
_GLTFAnimation._CreateBakedAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, minFrame, maxFrame, fps, sampleRate, inputs, outputs, minMaxFrames, useQuaternion) {
|
|
2208
1841
|
var value;
|
|
2209
1842
|
var quaternionCache = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity();
|
|
2210
1843
|
var previousTime = null;
|
|
@@ -2258,7 +1891,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2258
1891
|
loopMode: animation.loopMode,
|
|
2259
1892
|
};
|
|
2260
1893
|
value = animation._interpolate(f, state);
|
|
2261
|
-
_GLTFAnimation._SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs,
|
|
1894
|
+
_GLTFAnimation._SetInterpolatedValue(babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, useQuaternion);
|
|
2262
1895
|
}
|
|
2263
1896
|
}
|
|
2264
1897
|
}
|
|
@@ -2266,23 +1899,17 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2266
1899
|
minMaxFrames.max = maxUsedFrame;
|
|
2267
1900
|
}
|
|
2268
1901
|
};
|
|
2269
|
-
_GLTFAnimation._ConvertFactorToVector3OrQuaternion = function (factor, babylonTransformNode, animation, animationChannelTargetPath,
|
|
2270
|
-
var basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath,
|
|
1902
|
+
_GLTFAnimation._ConvertFactorToVector3OrQuaternion = function (factor, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion) {
|
|
1903
|
+
var basePositionRotationOrScale = _GLTFAnimation._GetBasePositionRotationOrScale(babylonTransformNode, animationChannelTargetPath, useQuaternion);
|
|
2271
1904
|
// handles single component x, y, z or w component animation by using a base property and animating over a component.
|
|
2272
1905
|
var property = animation.targetProperty.split(".");
|
|
2273
|
-
var componentName = property ? property[1] : ""; // x, y, or
|
|
1906
|
+
var componentName = property ? property[1] : ""; // x, y, z, or w component
|
|
2274
1907
|
var value = useQuaternion ? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(basePositionRotationOrScale).normalize() : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(basePositionRotationOrScale);
|
|
2275
1908
|
switch (componentName) {
|
|
2276
|
-
case "x":
|
|
2277
|
-
|
|
2278
|
-
break;
|
|
2279
|
-
}
|
|
2280
|
-
case "y": {
|
|
2281
|
-
value[componentName] = convertToRightHandedSystem && useQuaternion && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */ ? -factor : factor;
|
|
2282
|
-
break;
|
|
2283
|
-
}
|
|
1909
|
+
case "x":
|
|
1910
|
+
case "y":
|
|
2284
1911
|
case "z": {
|
|
2285
|
-
value[componentName] =
|
|
1912
|
+
value[componentName] = factor;
|
|
2286
1913
|
break;
|
|
2287
1914
|
}
|
|
2288
1915
|
case "w": {
|
|
@@ -2295,7 +1922,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2295
1922
|
}
|
|
2296
1923
|
return value;
|
|
2297
1924
|
};
|
|
2298
|
-
_GLTFAnimation._SetInterpolatedValue = function (babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs,
|
|
1925
|
+
_GLTFAnimation._SetInterpolatedValue = function (babylonTransformNode, value, time, animation, animationChannelTargetPath, quaternionCache, inputs, outputs, useQuaternion) {
|
|
2299
1926
|
var cacheValue;
|
|
2300
1927
|
inputs.push(time);
|
|
2301
1928
|
if (animationChannelTargetPath === "weights" /* AnimationChannelTargetPath.WEIGHTS */) {
|
|
@@ -2303,7 +1930,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2303
1930
|
return;
|
|
2304
1931
|
}
|
|
2305
1932
|
if (animation.dataType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT) {
|
|
2306
|
-
value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationChannelTargetPath,
|
|
1933
|
+
value = this._ConvertFactorToVector3OrQuaternion(value, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);
|
|
2307
1934
|
}
|
|
2308
1935
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
2309
1936
|
if (useQuaternion) {
|
|
@@ -2313,24 +1940,11 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2313
1940
|
cacheValue = value;
|
|
2314
1941
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRollToRef(cacheValue.y, cacheValue.x, cacheValue.z, quaternionCache);
|
|
2315
1942
|
}
|
|
2316
|
-
if (convertToRightHandedSystem) {
|
|
2317
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(quaternionCache);
|
|
2318
|
-
if (!babylonTransformNode.parent) {
|
|
2319
|
-
quaternionCache = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(quaternionCache);
|
|
2320
|
-
}
|
|
2321
|
-
}
|
|
2322
1943
|
outputs.push(quaternionCache.asArray());
|
|
2323
1944
|
}
|
|
2324
1945
|
else {
|
|
2325
1946
|
// scaling and position animation
|
|
2326
1947
|
cacheValue = value;
|
|
2327
|
-
if (convertToRightHandedSystem && animationChannelTargetPath !== "scale" /* AnimationChannelTargetPath.SCALE */) {
|
|
2328
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionVector3FromRef(cacheValue);
|
|
2329
|
-
if (!babylonTransformNode.parent) {
|
|
2330
|
-
cacheValue.x *= -1;
|
|
2331
|
-
cacheValue.z *= -1;
|
|
2332
|
-
}
|
|
2333
|
-
}
|
|
2334
1948
|
outputs.push(cacheValue.asArray());
|
|
2335
1949
|
}
|
|
2336
1950
|
};
|
|
@@ -2339,17 +1953,15 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2339
1953
|
* @param babylonTransformNode BabylonJS mesh
|
|
2340
1954
|
* @param animation BabylonJS animation
|
|
2341
1955
|
* @param animationChannelTargetPath The target animation channel
|
|
2342
|
-
* @param frameDelta The difference between the last and first frame of the animation
|
|
2343
1956
|
* @param inputs Array to store the key frame times
|
|
2344
1957
|
* @param outputs Array to store the key frame data
|
|
2345
|
-
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
2346
1958
|
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
2347
1959
|
*/
|
|
2348
|
-
_GLTFAnimation._CreateLinearOrStepAnimation = function (babylonTransformNode, animation, animationChannelTargetPath,
|
|
1960
|
+
_GLTFAnimation._CreateLinearOrStepAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion) {
|
|
2349
1961
|
for (var _i = 0, _a = animation.getKeys(); _i < _a.length; _i++) {
|
|
2350
1962
|
var keyFrame = _a[_i];
|
|
2351
1963
|
inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.
|
|
2352
|
-
_GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode,
|
|
1964
|
+
_GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion);
|
|
2353
1965
|
}
|
|
2354
1966
|
};
|
|
2355
1967
|
/**
|
|
@@ -2360,42 +1972,31 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2360
1972
|
* @param frameDelta The difference between the last and first frame of the animation
|
|
2361
1973
|
* @param inputs Array to store the key frame times
|
|
2362
1974
|
* @param outputs Array to store the key frame data
|
|
2363
|
-
* @param convertToRightHandedSystem Specifies if the position data should be converted to right handed
|
|
2364
1975
|
* @param useQuaternion Specifies if quaternions are used in the animation
|
|
2365
1976
|
*/
|
|
2366
|
-
_GLTFAnimation._CreateCubicSplineAnimation = function (babylonTransformNode, animation, animationChannelTargetPath,
|
|
1977
|
+
_GLTFAnimation._CreateCubicSplineAnimation = function (babylonTransformNode, animation, animationChannelTargetPath, inputs, outputs, useQuaternion) {
|
|
2367
1978
|
animation.getKeys().forEach(function (keyFrame) {
|
|
2368
1979
|
inputs.push(keyFrame.frame / animation.framePerSecond); // keyframes in seconds.
|
|
2369
|
-
_GLTFAnimation._AddSplineTangent(
|
|
2370
|
-
_GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode,
|
|
2371
|
-
_GLTFAnimation._AddSplineTangent(
|
|
1980
|
+
_GLTFAnimation._AddSplineTangent(_TangentType.INTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, useQuaternion);
|
|
1981
|
+
_GLTFAnimation._AddKeyframeValue(keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion);
|
|
1982
|
+
_GLTFAnimation._AddSplineTangent(_TangentType.OUTTANGENT, outputs, animationChannelTargetPath, "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */, keyFrame, useQuaternion);
|
|
2372
1983
|
});
|
|
2373
1984
|
};
|
|
2374
|
-
_GLTFAnimation._GetBasePositionRotationOrScale = function (babylonTransformNode, animationChannelTargetPath,
|
|
1985
|
+
_GLTFAnimation._GetBasePositionRotationOrScale = function (babylonTransformNode, animationChannelTargetPath, useQuaternion) {
|
|
2375
1986
|
var basePositionRotationOrScale;
|
|
2376
1987
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
2377
1988
|
if (useQuaternion) {
|
|
2378
1989
|
var q = babylonTransformNode.rotationQuaternion;
|
|
2379
1990
|
basePositionRotationOrScale = (q !== null && q !== void 0 ? q : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity()).asArray();
|
|
2380
|
-
if (convertToRightHandedSystem) {
|
|
2381
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(basePositionRotationOrScale);
|
|
2382
|
-
if (!babylonTransformNode.parent) {
|
|
2383
|
-
basePositionRotationOrScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(basePositionRotationOrScale)).asArray();
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
1991
|
}
|
|
2387
1992
|
else {
|
|
2388
1993
|
var r = babylonTransformNode.rotation;
|
|
2389
1994
|
basePositionRotationOrScale = (r !== null && r !== void 0 ? r : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero()).asArray();
|
|
2390
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedNormalArray3FromRef(basePositionRotationOrScale);
|
|
2391
1995
|
}
|
|
2392
1996
|
}
|
|
2393
1997
|
else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
|
|
2394
1998
|
var p = babylonTransformNode.position;
|
|
2395
1999
|
basePositionRotationOrScale = (p !== null && p !== void 0 ? p : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero()).asArray();
|
|
2396
|
-
if (convertToRightHandedSystem) {
|
|
2397
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionArray3FromRef(basePositionRotationOrScale);
|
|
2398
|
-
}
|
|
2399
2000
|
}
|
|
2400
2001
|
else {
|
|
2401
2002
|
// scale
|
|
@@ -2411,35 +2012,18 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2411
2012
|
* @param outputs
|
|
2412
2013
|
* @param animationChannelTargetPath
|
|
2413
2014
|
* @param babylonTransformNode
|
|
2414
|
-
* @param convertToRightHandedSystem
|
|
2415
2015
|
* @param useQuaternion
|
|
2416
2016
|
*/
|
|
2417
|
-
_GLTFAnimation._AddKeyframeValue = function (keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode,
|
|
2418
|
-
var value;
|
|
2017
|
+
_GLTFAnimation._AddKeyframeValue = function (keyFrame, animation, outputs, animationChannelTargetPath, babylonTransformNode, useQuaternion) {
|
|
2419
2018
|
var newPositionRotationOrScale;
|
|
2420
2019
|
var animationType = animation.dataType;
|
|
2421
2020
|
if (animationType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_VECTOR3) {
|
|
2422
|
-
value = keyFrame.value.asArray();
|
|
2021
|
+
var value = keyFrame.value.asArray();
|
|
2423
2022
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
2424
2023
|
var array = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(value);
|
|
2425
2024
|
var rotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(array.y, array.x, array.z);
|
|
2426
|
-
if (convertToRightHandedSystem) {
|
|
2427
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);
|
|
2428
|
-
if (!babylonTransformNode.parent) {
|
|
2429
|
-
rotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(rotationQuaternion);
|
|
2430
|
-
}
|
|
2431
|
-
}
|
|
2432
2025
|
value = rotationQuaternion.asArray();
|
|
2433
2026
|
}
|
|
2434
|
-
else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
|
|
2435
|
-
if (convertToRightHandedSystem) {
|
|
2436
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedNormalArray3FromRef(value);
|
|
2437
|
-
if (!babylonTransformNode.parent) {
|
|
2438
|
-
value[0] *= -1;
|
|
2439
|
-
value[2] *= -1;
|
|
2440
|
-
}
|
|
2441
|
-
}
|
|
2442
|
-
}
|
|
2443
2027
|
outputs.push(value); // scale vector.
|
|
2444
2028
|
}
|
|
2445
2029
|
else if (animationType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_FLOAT) {
|
|
@@ -2448,42 +2032,20 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2448
2032
|
}
|
|
2449
2033
|
else {
|
|
2450
2034
|
// handles single component x, y, z or w component animation by using a base property and animating over a component.
|
|
2451
|
-
newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationChannelTargetPath,
|
|
2035
|
+
newPositionRotationOrScale = this._ConvertFactorToVector3OrQuaternion(keyFrame.value, babylonTransformNode, animation, animationChannelTargetPath, useQuaternion);
|
|
2452
2036
|
if (newPositionRotationOrScale) {
|
|
2453
2037
|
if (animationChannelTargetPath === "rotation" /* AnimationChannelTargetPath.ROTATION */) {
|
|
2454
2038
|
var posRotScale = useQuaternion
|
|
2455
2039
|
? newPositionRotationOrScale
|
|
2456
2040
|
: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(newPositionRotationOrScale.y, newPositionRotationOrScale.x, newPositionRotationOrScale.z).normalize();
|
|
2457
|
-
if (convertToRightHandedSystem) {
|
|
2458
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionFromRef(posRotScale);
|
|
2459
|
-
if (!babylonTransformNode.parent) {
|
|
2460
|
-
posRotScale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(posRotScale);
|
|
2461
|
-
}
|
|
2462
|
-
}
|
|
2463
2041
|
outputs.push(posRotScale.asArray());
|
|
2464
2042
|
}
|
|
2465
|
-
else if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
|
|
2466
|
-
if (convertToRightHandedSystem) {
|
|
2467
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedNormalVector3FromRef(newPositionRotationOrScale);
|
|
2468
|
-
if (!babylonTransformNode.parent) {
|
|
2469
|
-
newPositionRotationOrScale.x *= -1;
|
|
2470
|
-
newPositionRotationOrScale.z *= -1;
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
}
|
|
2474
2043
|
outputs.push(newPositionRotationOrScale.asArray());
|
|
2475
2044
|
}
|
|
2476
2045
|
}
|
|
2477
2046
|
}
|
|
2478
2047
|
else if (animationType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Animation.ANIMATIONTYPE_QUATERNION) {
|
|
2479
|
-
|
|
2480
|
-
if (convertToRightHandedSystem) {
|
|
2481
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(value);
|
|
2482
|
-
if (!babylonTransformNode.parent) {
|
|
2483
|
-
value = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(value)).asArray();
|
|
2484
|
-
}
|
|
2485
|
-
}
|
|
2486
|
-
outputs.push(value);
|
|
2048
|
+
outputs.push(keyFrame.value.normalize().asArray());
|
|
2487
2049
|
}
|
|
2488
2050
|
else {
|
|
2489
2051
|
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("glTFAnimation: Unsupported key frame values for animation!");
|
|
@@ -2551,9 +2113,8 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2551
2113
|
* @param keyFrame The key frame with the animation data
|
|
2552
2114
|
* @param frameDelta Time difference between two frames used to scale the tangent by the frame delta
|
|
2553
2115
|
* @param useQuaternion Specifies if quaternions are used
|
|
2554
|
-
* @param convertToRightHandedSystem Specifies if the values should be converted to right-handed
|
|
2555
2116
|
*/
|
|
2556
|
-
_GLTFAnimation._AddSplineTangent = function (
|
|
2117
|
+
_GLTFAnimation._AddSplineTangent = function (tangentType, outputs, animationChannelTargetPath, interpolation, keyFrame, useQuaternion) {
|
|
2557
2118
|
var tangent;
|
|
2558
2119
|
var tangentValue = tangentType === _TangentType.INTANGENT ? keyFrame.inTangent : keyFrame.outTangent;
|
|
2559
2120
|
if (interpolation === "CUBICSPLINE" /* AnimationSamplerInterpolation.CUBICSPLINE */) {
|
|
@@ -2566,12 +2127,6 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2566
2127
|
var array = tangentValue;
|
|
2567
2128
|
tangent = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(array.y, array.x, array.z).asArray();
|
|
2568
2129
|
}
|
|
2569
|
-
if (convertToRightHandedSystem) {
|
|
2570
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedQuaternionArrayFromRef(tangent);
|
|
2571
|
-
if (!babylonTransformNode.parent) {
|
|
2572
|
-
tangent = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArray(tangent)).asArray();
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
2130
|
}
|
|
2576
2131
|
else {
|
|
2577
2132
|
tangent = [0, 0, 0, 0];
|
|
@@ -2588,15 +2143,6 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2588
2143
|
else {
|
|
2589
2144
|
if (tangentValue) {
|
|
2590
2145
|
tangent = tangentValue.asArray();
|
|
2591
|
-
if (convertToRightHandedSystem) {
|
|
2592
|
-
if (animationChannelTargetPath === "translation" /* AnimationChannelTargetPath.TRANSLATION */) {
|
|
2593
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_1__._GLTFUtilities._GetRightHandedPositionArray3FromRef(tangent);
|
|
2594
|
-
if (!babylonTransformNode.parent) {
|
|
2595
|
-
tangent[0] *= -1; // x
|
|
2596
|
-
tangent[2] *= -1; // z
|
|
2597
|
-
}
|
|
2598
|
-
}
|
|
2599
|
-
}
|
|
2600
2146
|
}
|
|
2601
2147
|
else {
|
|
2602
2148
|
tangent = [0, 0, 0];
|
|
@@ -2634,7 +2180,7 @@ var _GLTFAnimation = /** @class */ (function () {
|
|
|
2634
2180
|
|
|
2635
2181
|
__webpack_require__.r(__webpack_exports__);
|
|
2636
2182
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2637
|
-
/* harmony export */
|
|
2183
|
+
/* harmony export */ GLTFData: () => (/* binding */ GLTFData)
|
|
2638
2184
|
/* harmony export */ });
|
|
2639
2185
|
/**
|
|
2640
2186
|
* Class for holding and downloading glTF file data
|
|
@@ -2700,16 +2246,16 @@ var GLTFData = /** @class */ (function () {
|
|
|
2700
2246
|
|
|
2701
2247
|
__webpack_require__.r(__webpack_exports__);
|
|
2702
2248
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2703
|
-
/* harmony export */
|
|
2704
|
-
/* harmony export */
|
|
2249
|
+
/* harmony export */ _BinaryWriter: () => (/* binding */ _BinaryWriter),
|
|
2250
|
+
/* harmony export */ _Exporter: () => (/* binding */ _Exporter)
|
|
2705
2251
|
/* harmony export */ });
|
|
2706
|
-
/* harmony import */ var
|
|
2707
|
-
/* harmony import */ var
|
|
2708
|
-
/* harmony import */ var
|
|
2709
|
-
/* harmony import */ var
|
|
2710
|
-
/* harmony import */ var
|
|
2711
|
-
/* harmony import */ var
|
|
2712
|
-
/* harmony import */ var
|
|
2252
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
2253
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Materials/multiMaterial */ "core/Maths/math.vector");
|
|
2254
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
2255
|
+
/* harmony import */ var _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFMaterialExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFMaterialExporter.js");
|
|
2256
|
+
/* harmony import */ var _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glTFUtilities */ "../../../lts/serializers/dist/glTF/2.0/glTFUtilities.js");
|
|
2257
|
+
/* harmony import */ var _glTFData__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./glTFData */ "../../../lts/serializers/dist/glTF/2.0/glTFData.js");
|
|
2258
|
+
/* harmony import */ var _glTFAnimation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./glTFAnimation */ "../../../lts/serializers/dist/glTF/2.0/glTFAnimation.js");
|
|
2713
2259
|
|
|
2714
2260
|
|
|
2715
2261
|
|
|
@@ -2730,7 +2276,55 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2730
2276
|
|
|
2731
2277
|
|
|
2732
2278
|
// Matrix that converts handedness on the X-axis.
|
|
2733
|
-
var convertHandednessMatrix =
|
|
2279
|
+
var convertHandednessMatrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.Compose(new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(-1, 1, 1), core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.Identity(), core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero());
|
|
2280
|
+
function isNoopNode(node, useRightHandedSystem) {
|
|
2281
|
+
if (!(node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TransformNode)) {
|
|
2282
|
+
return false;
|
|
2283
|
+
}
|
|
2284
|
+
// Transform
|
|
2285
|
+
if (useRightHandedSystem) {
|
|
2286
|
+
var matrix = node.getWorldMatrix();
|
|
2287
|
+
if (!matrix.isIdentity()) {
|
|
2288
|
+
return false;
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
else {
|
|
2292
|
+
var matrix = node.getWorldMatrix().multiplyToRef(convertHandednessMatrix, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[0]);
|
|
2293
|
+
if (!matrix.isIdentity()) {
|
|
2294
|
+
return false;
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
// Geometry
|
|
2298
|
+
if ((node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh && node.geometry) || (node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.InstancedMesh && node.sourceMesh.geometry)) {
|
|
2299
|
+
return false;
|
|
2300
|
+
}
|
|
2301
|
+
return true;
|
|
2302
|
+
}
|
|
2303
|
+
function convertNodeHandedness(node) {
|
|
2304
|
+
var translation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(node.translation || [0, 0, 0], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[0]);
|
|
2305
|
+
var rotation = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.FromArrayToRef(node.rotation || [0, 0, 0, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Quaternion[0]);
|
|
2306
|
+
var scale = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArrayToRef(node.scale || [1, 1, 1], 0, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Vector3[1]);
|
|
2307
|
+
var matrix = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Matrix.ComposeToRef(scale, rotation, translation, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[0]).multiplyToRef(convertHandednessMatrix, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TmpVectors.Matrix[0]);
|
|
2308
|
+
matrix.decompose(scale, rotation, translation);
|
|
2309
|
+
if (translation.equalsToFloats(0, 0, 0)) {
|
|
2310
|
+
delete node.translation;
|
|
2311
|
+
}
|
|
2312
|
+
else {
|
|
2313
|
+
node.translation = translation.asArray();
|
|
2314
|
+
}
|
|
2315
|
+
if (core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(rotation)) {
|
|
2316
|
+
delete node.rotation;
|
|
2317
|
+
}
|
|
2318
|
+
else {
|
|
2319
|
+
node.rotation = rotation.asArray();
|
|
2320
|
+
}
|
|
2321
|
+
if (scale.equalsToFloats(1, 1, 1)) {
|
|
2322
|
+
delete node.scale;
|
|
2323
|
+
}
|
|
2324
|
+
else {
|
|
2325
|
+
node.scale = scale.asArray();
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2734
2328
|
/**
|
|
2735
2329
|
* Converts Babylon Scene into glTF 2.0.
|
|
2736
2330
|
* @internal
|
|
@@ -2742,15 +2336,11 @@ var _Exporter = /** @class */ (function () {
|
|
|
2742
2336
|
* @param options Options to modify the behavior of the exporter
|
|
2743
2337
|
*/
|
|
2744
2338
|
function _Exporter(babylonScene, options) {
|
|
2745
|
-
/*
|
|
2746
|
-
* Specifies if root Babylon empty nodes that act as a coordinate space transform should be included in export
|
|
2747
|
-
*/
|
|
2748
|
-
this._includeCoordinateSystemConversionNodes = false;
|
|
2749
2339
|
this._extensions = {};
|
|
2750
2340
|
this._glTF = {
|
|
2751
|
-
asset: { generator: "Babylon.js v".concat(
|
|
2341
|
+
asset: { generator: "Babylon.js v".concat(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Engine.Version), version: "2.0" },
|
|
2752
2342
|
};
|
|
2753
|
-
babylonScene = babylonScene ||
|
|
2343
|
+
babylonScene = babylonScene || core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.EngineStore.LastCreatedScene;
|
|
2754
2344
|
if (!babylonScene) {
|
|
2755
2345
|
return;
|
|
2756
2346
|
}
|
|
@@ -2771,9 +2361,8 @@ var _Exporter = /** @class */ (function () {
|
|
|
2771
2361
|
this._imageData = {};
|
|
2772
2362
|
this._orderedImageData = [];
|
|
2773
2363
|
this._options = options || {};
|
|
2774
|
-
this._animationSampleRate =
|
|
2775
|
-
this.
|
|
2776
|
-
this._glTFMaterialExporter = new _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_2__._GLTFMaterialExporter(this);
|
|
2364
|
+
this._animationSampleRate = this._options.animationSampleRate || 1 / 60;
|
|
2365
|
+
this._glTFMaterialExporter = new _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_1__._GLTFMaterialExporter(this);
|
|
2777
2366
|
this._loadExtensions();
|
|
2778
2367
|
}
|
|
2779
2368
|
_Exporter.prototype._applyExtension = function (node, extensions, index, actionAsync) {
|
|
@@ -2893,7 +2482,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
2893
2482
|
*/
|
|
2894
2483
|
_Exporter.RegisterExtension = function (name, factory) {
|
|
2895
2484
|
if (_Exporter.UnregisterExtension(name)) {
|
|
2896
|
-
|
|
2485
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Extension with the name ".concat(name, " already exists"));
|
|
2897
2486
|
}
|
|
2898
2487
|
_Exporter._ExtensionFactories[name] = factory;
|
|
2899
2488
|
_Exporter._ExtensionNames.push(name);
|
|
@@ -2916,7 +2505,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
2916
2505
|
};
|
|
2917
2506
|
_Exporter.prototype._reorderIndicesBasedOnPrimitiveMode = function (submesh, primitiveMode, babylonIndices, byteOffset, binaryWriter) {
|
|
2918
2507
|
switch (primitiveMode) {
|
|
2919
|
-
case
|
|
2508
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFillMode: {
|
|
2920
2509
|
if (!byteOffset) {
|
|
2921
2510
|
byteOffset = 0;
|
|
2922
2511
|
}
|
|
@@ -2930,14 +2519,14 @@ var _Exporter = /** @class */ (function () {
|
|
|
2930
2519
|
}
|
|
2931
2520
|
break;
|
|
2932
2521
|
}
|
|
2933
|
-
case
|
|
2522
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFanDrawMode: {
|
|
2934
2523
|
for (var i = submesh.indexStart + submesh.indexCount - 1, start = submesh.indexStart; i >= start; --i) {
|
|
2935
2524
|
binaryWriter.setUInt32(babylonIndices[i], byteOffset);
|
|
2936
2525
|
byteOffset += 4;
|
|
2937
2526
|
}
|
|
2938
2527
|
break;
|
|
2939
2528
|
}
|
|
2940
|
-
case
|
|
2529
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleStripDrawMode: {
|
|
2941
2530
|
if (submesh.indexCount >= 3) {
|
|
2942
2531
|
binaryWriter.setUInt32(babylonIndices[submesh.indexStart + 2], byteOffset + 4);
|
|
2943
2532
|
binaryWriter.setUInt32(babylonIndices[submesh.indexStart + 1], byteOffset + 8);
|
|
@@ -2951,28 +2540,24 @@ var _Exporter = /** @class */ (function () {
|
|
|
2951
2540
|
* clock-wise during export to glTF
|
|
2952
2541
|
* @param submesh BabylonJS submesh
|
|
2953
2542
|
* @param primitiveMode Primitive mode of the mesh
|
|
2954
|
-
* @param sideOrientation the winding order of the submesh
|
|
2955
2543
|
* @param vertexBufferKind The type of vertex attribute
|
|
2956
2544
|
* @param meshAttributeArray The vertex attribute data
|
|
2957
2545
|
* @param byteOffset The offset to the binary data
|
|
2958
2546
|
* @param binaryWriter The binary data for the glTF file
|
|
2959
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2960
2547
|
*/
|
|
2961
|
-
_Exporter.prototype._reorderVertexAttributeDataBasedOnPrimitiveMode = function (submesh, primitiveMode,
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
break;
|
|
2975
|
-
}
|
|
2548
|
+
_Exporter.prototype._reorderVertexAttributeDataBasedOnPrimitiveMode = function (submesh, primitiveMode, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
2549
|
+
switch (primitiveMode) {
|
|
2550
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFillMode: {
|
|
2551
|
+
this._reorderTriangleFillMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
2552
|
+
break;
|
|
2553
|
+
}
|
|
2554
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleStripDrawMode: {
|
|
2555
|
+
this._reorderTriangleStripDrawMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
2556
|
+
break;
|
|
2557
|
+
}
|
|
2558
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFanDrawMode: {
|
|
2559
|
+
this._reorderTriangleFanMode(submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter);
|
|
2560
|
+
break;
|
|
2976
2561
|
}
|
|
2977
2562
|
}
|
|
2978
2563
|
};
|
|
@@ -2980,202 +2565,193 @@ var _Exporter = /** @class */ (function () {
|
|
|
2980
2565
|
* Reorders the vertex attributes in the correct triangle mode order . This is necessary when indices are not available and the winding order is
|
|
2981
2566
|
* clock-wise during export to glTF
|
|
2982
2567
|
* @param submesh BabylonJS submesh
|
|
2983
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
2984
|
-
* @param sideOrientation the winding order of the submesh
|
|
2985
2568
|
* @param vertexBufferKind The type of vertex attribute
|
|
2986
2569
|
* @param meshAttributeArray The vertex attribute data
|
|
2987
2570
|
* @param byteOffset The offset to the binary data
|
|
2988
2571
|
* @param binaryWriter The binary data for the glTF file
|
|
2989
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
2990
2572
|
*/
|
|
2991
|
-
_Exporter.prototype._reorderTriangleFillMode = function (submesh,
|
|
2573
|
+
_Exporter.prototype._reorderTriangleFillMode = function (submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
2992
2574
|
var vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
2993
2575
|
if (vertexBuffer) {
|
|
2994
|
-
var stride = vertexBuffer.byteStride /
|
|
2576
|
+
var stride = vertexBuffer.byteStride / core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
|
|
2995
2577
|
if (submesh.verticesCount % 3 !== 0) {
|
|
2996
|
-
|
|
2578
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("The submesh vertices for the triangle fill mode is not divisible by 3!");
|
|
2997
2579
|
}
|
|
2998
2580
|
else {
|
|
2999
2581
|
var vertexData = [];
|
|
3000
2582
|
var index = 0;
|
|
3001
2583
|
switch (vertexBufferKind) {
|
|
3002
|
-
case
|
|
3003
|
-
case
|
|
2584
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind:
|
|
2585
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
3004
2586
|
for (var x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {
|
|
3005
2587
|
index = x * stride;
|
|
3006
|
-
vertexData.push(
|
|
3007
|
-
vertexData.push(
|
|
3008
|
-
vertexData.push(
|
|
2588
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index));
|
|
2589
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2590
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + stride));
|
|
3009
2591
|
}
|
|
3010
2592
|
break;
|
|
3011
2593
|
}
|
|
3012
|
-
case
|
|
2594
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
3013
2595
|
for (var x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {
|
|
3014
2596
|
index = x * stride;
|
|
3015
|
-
vertexData.push(
|
|
3016
|
-
vertexData.push(
|
|
3017
|
-
vertexData.push(
|
|
2597
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index));
|
|
2598
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2599
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index + stride));
|
|
3018
2600
|
}
|
|
3019
2601
|
break;
|
|
3020
2602
|
}
|
|
3021
|
-
case
|
|
2603
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind: {
|
|
3022
2604
|
var size = vertexBuffer.getSize();
|
|
3023
2605
|
for (var x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + size) {
|
|
3024
2606
|
index = x * stride;
|
|
3025
2607
|
if (size === 4) {
|
|
3026
|
-
vertexData.push(
|
|
3027
|
-
vertexData.push(
|
|
3028
|
-
vertexData.push(
|
|
2608
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index));
|
|
2609
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2610
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index + stride));
|
|
3029
2611
|
}
|
|
3030
2612
|
else {
|
|
3031
|
-
vertexData.push(
|
|
3032
|
-
vertexData.push(
|
|
3033
|
-
vertexData.push(
|
|
2613
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index));
|
|
2614
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2615
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + stride));
|
|
3034
2616
|
}
|
|
3035
2617
|
}
|
|
3036
2618
|
break;
|
|
3037
2619
|
}
|
|
3038
|
-
case
|
|
3039
|
-
case
|
|
2620
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind:
|
|
2621
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind: {
|
|
3040
2622
|
for (var x = submesh.verticesStart; x < submesh.verticesStart + submesh.verticesCount; x = x + 3) {
|
|
3041
2623
|
index = x * stride;
|
|
3042
|
-
vertexData.push(
|
|
3043
|
-
vertexData.push(
|
|
3044
|
-
vertexData.push(
|
|
2624
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index));
|
|
2625
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2626
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index + stride));
|
|
3045
2627
|
}
|
|
3046
2628
|
break;
|
|
3047
2629
|
}
|
|
3048
2630
|
default: {
|
|
3049
|
-
|
|
2631
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
|
|
3050
2632
|
}
|
|
3051
2633
|
}
|
|
3052
|
-
this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind,
|
|
2634
|
+
this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);
|
|
3053
2635
|
}
|
|
3054
2636
|
}
|
|
3055
2637
|
else {
|
|
3056
|
-
|
|
2638
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("reorderTriangleFillMode: Vertex Buffer Kind ".concat(vertexBufferKind, " not present!"));
|
|
3057
2639
|
}
|
|
3058
2640
|
};
|
|
3059
2641
|
/**
|
|
3060
2642
|
* Reorders the vertex attributes in the correct triangle strip order. This is necessary when indices are not available and the winding order is
|
|
3061
2643
|
* clock-wise during export to glTF
|
|
3062
2644
|
* @param submesh BabylonJS submesh
|
|
3063
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
3064
|
-
* @param sideOrientation the winding order of the submesh
|
|
3065
2645
|
* @param vertexBufferKind The type of vertex attribute
|
|
3066
2646
|
* @param meshAttributeArray The vertex attribute data
|
|
3067
2647
|
* @param byteOffset The offset to the binary data
|
|
3068
2648
|
* @param binaryWriter The binary data for the glTF file
|
|
3069
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3070
2649
|
*/
|
|
3071
|
-
_Exporter.prototype._reorderTriangleStripDrawMode = function (submesh,
|
|
2650
|
+
_Exporter.prototype._reorderTriangleStripDrawMode = function (submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
3072
2651
|
var vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
3073
2652
|
if (vertexBuffer) {
|
|
3074
|
-
var stride = vertexBuffer.byteStride /
|
|
2653
|
+
var stride = vertexBuffer.byteStride / core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
|
|
3075
2654
|
var vertexData = [];
|
|
3076
2655
|
var index = 0;
|
|
3077
2656
|
switch (vertexBufferKind) {
|
|
3078
|
-
case
|
|
3079
|
-
case
|
|
2657
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind:
|
|
2658
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
3080
2659
|
index = submesh.verticesStart;
|
|
3081
|
-
vertexData.push(
|
|
3082
|
-
vertexData.push(
|
|
2660
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + 2 * stride));
|
|
2661
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index + stride));
|
|
3083
2662
|
break;
|
|
3084
2663
|
}
|
|
3085
|
-
case
|
|
2664
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
3086
2665
|
for (var x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
3087
2666
|
index = x * stride;
|
|
3088
|
-
vertexData.push(
|
|
2667
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index));
|
|
3089
2668
|
}
|
|
3090
2669
|
break;
|
|
3091
2670
|
}
|
|
3092
|
-
case
|
|
2671
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind: {
|
|
3093
2672
|
for (var x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
3094
2673
|
index = x * stride;
|
|
3095
2674
|
vertexBuffer.getSize() === 4
|
|
3096
|
-
? vertexData.push(
|
|
3097
|
-
: vertexData.push(
|
|
2675
|
+
? vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index))
|
|
2676
|
+
: vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index));
|
|
3098
2677
|
}
|
|
3099
2678
|
break;
|
|
3100
2679
|
}
|
|
3101
|
-
case
|
|
3102
|
-
case
|
|
2680
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind:
|
|
2681
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind: {
|
|
3103
2682
|
for (var x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
3104
2683
|
index = x * stride;
|
|
3105
|
-
vertexData.push(
|
|
2684
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index));
|
|
3106
2685
|
}
|
|
3107
2686
|
break;
|
|
3108
2687
|
}
|
|
3109
2688
|
default: {
|
|
3110
|
-
|
|
2689
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
|
|
3111
2690
|
}
|
|
3112
2691
|
}
|
|
3113
|
-
this._writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind,
|
|
2692
|
+
this._writeVertexAttributeData(vertexData, byteOffset + 12, vertexBufferKind, binaryWriter);
|
|
3114
2693
|
}
|
|
3115
2694
|
else {
|
|
3116
|
-
|
|
2695
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("reorderTriangleStripDrawMode: Vertex buffer kind ".concat(vertexBufferKind, " not present!"));
|
|
3117
2696
|
}
|
|
3118
2697
|
};
|
|
3119
2698
|
/**
|
|
3120
2699
|
* Reorders the vertex attributes in the correct triangle fan order. This is necessary when indices are not available and the winding order is
|
|
3121
2700
|
* clock-wise during export to glTF
|
|
3122
2701
|
* @param submesh BabylonJS submesh
|
|
3123
|
-
* @param primitiveMode Primitive mode of the mesh
|
|
3124
|
-
* @param sideOrientation the winding order of the submesh
|
|
3125
2702
|
* @param vertexBufferKind The type of vertex attribute
|
|
3126
2703
|
* @param meshAttributeArray The vertex attribute data
|
|
3127
2704
|
* @param byteOffset The offset to the binary data
|
|
3128
2705
|
* @param binaryWriter The binary data for the glTF file
|
|
3129
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3130
2706
|
*/
|
|
3131
|
-
_Exporter.prototype._reorderTriangleFanMode = function (submesh,
|
|
2707
|
+
_Exporter.prototype._reorderTriangleFanMode = function (submesh, vertexBufferKind, meshAttributeArray, byteOffset, binaryWriter) {
|
|
3132
2708
|
var vertexBuffer = this._getVertexBufferFromMesh(vertexBufferKind, submesh.getMesh());
|
|
3133
2709
|
if (vertexBuffer) {
|
|
3134
|
-
var stride = vertexBuffer.byteStride /
|
|
2710
|
+
var stride = vertexBuffer.byteStride / core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.GetTypeByteLength(vertexBuffer.type);
|
|
3135
2711
|
var vertexData = [];
|
|
3136
2712
|
var index = 0;
|
|
3137
2713
|
switch (vertexBufferKind) {
|
|
3138
|
-
case
|
|
3139
|
-
case
|
|
2714
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind:
|
|
2715
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
3140
2716
|
for (var x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
3141
2717
|
index = x * stride;
|
|
3142
|
-
vertexData.push(
|
|
2718
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index));
|
|
3143
2719
|
}
|
|
3144
2720
|
break;
|
|
3145
2721
|
}
|
|
3146
|
-
case
|
|
2722
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
3147
2723
|
for (var x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
3148
2724
|
index = x * stride;
|
|
3149
|
-
vertexData.push(
|
|
2725
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index));
|
|
3150
2726
|
}
|
|
3151
2727
|
break;
|
|
3152
2728
|
}
|
|
3153
|
-
case
|
|
2729
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind: {
|
|
3154
2730
|
for (var x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
3155
2731
|
index = x * stride;
|
|
3156
|
-
vertexData.push(
|
|
2732
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index));
|
|
3157
2733
|
vertexBuffer.getSize() === 4
|
|
3158
|
-
? vertexData.push(
|
|
3159
|
-
: vertexData.push(
|
|
2734
|
+
? vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index))
|
|
2735
|
+
: vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index));
|
|
3160
2736
|
}
|
|
3161
2737
|
break;
|
|
3162
2738
|
}
|
|
3163
|
-
case
|
|
3164
|
-
case
|
|
2739
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind:
|
|
2740
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind: {
|
|
3165
2741
|
for (var x = submesh.verticesStart + submesh.verticesCount - 1; x >= submesh.verticesStart; --x) {
|
|
3166
2742
|
index = x * stride;
|
|
3167
|
-
vertexData.push(
|
|
2743
|
+
vertexData.push(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index));
|
|
3168
2744
|
}
|
|
3169
2745
|
break;
|
|
3170
2746
|
}
|
|
3171
2747
|
default: {
|
|
3172
|
-
|
|
2748
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("Unsupported Vertex Buffer type: ".concat(vertexBufferKind));
|
|
3173
2749
|
}
|
|
3174
2750
|
}
|
|
3175
|
-
this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind,
|
|
2751
|
+
this._writeVertexAttributeData(vertexData, byteOffset, vertexBufferKind, binaryWriter);
|
|
3176
2752
|
}
|
|
3177
2753
|
else {
|
|
3178
|
-
|
|
2754
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("reorderTriangleFanMode: Vertex buffer kind ".concat(vertexBufferKind, " not present!"));
|
|
3179
2755
|
}
|
|
3180
2756
|
};
|
|
3181
2757
|
/**
|
|
@@ -3183,34 +2759,16 @@ var _Exporter = /** @class */ (function () {
|
|
|
3183
2759
|
* @param vertices The vertices to write to the binary writer
|
|
3184
2760
|
* @param byteOffset The offset into the binary writer to overwrite binary data
|
|
3185
2761
|
* @param vertexAttributeKind The vertex attribute type
|
|
3186
|
-
* @param meshAttributeArray The vertex attribute data
|
|
3187
2762
|
* @param binaryWriter The writer containing the binary data
|
|
3188
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3189
2763
|
*/
|
|
3190
|
-
_Exporter.prototype._writeVertexAttributeData = function (vertices, byteOffset, vertexAttributeKind,
|
|
2764
|
+
_Exporter.prototype._writeVertexAttributeData = function (vertices, byteOffset, vertexAttributeKind, binaryWriter) {
|
|
3191
2765
|
for (var _i = 0, vertices_1 = vertices; _i < vertices_1.length; _i++) {
|
|
3192
2766
|
var vertex = vertices_1[_i];
|
|
3193
|
-
if (
|
|
3194
|
-
if (vertex instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3) {
|
|
3195
|
-
if (vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind) {
|
|
3196
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedNormalVector3FromRef(vertex);
|
|
3197
|
-
}
|
|
3198
|
-
else if (vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.PositionKind) {
|
|
3199
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3FromRef(vertex);
|
|
3200
|
-
}
|
|
3201
|
-
else {
|
|
3202
|
-
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Tools.Error("Unsupported vertex attribute kind!");
|
|
3203
|
-
}
|
|
3204
|
-
}
|
|
3205
|
-
else {
|
|
3206
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedVector4FromRef(vertex);
|
|
3207
|
-
}
|
|
3208
|
-
}
|
|
3209
|
-
if (vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.VertexBuffer.NormalKind) {
|
|
2767
|
+
if (vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind) {
|
|
3210
2768
|
vertex.normalize();
|
|
3211
2769
|
}
|
|
3212
|
-
else if (vertexAttributeKind ===
|
|
3213
|
-
|
|
2770
|
+
else if (vertexAttributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind && vertex instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4) {
|
|
2771
|
+
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._NormalizeTangentFromRef(vertex);
|
|
3214
2772
|
}
|
|
3215
2773
|
for (var _a = 0, _b = vertex.asArray(); _a < _b.length; _a++) {
|
|
3216
2774
|
var component = _b[_a];
|
|
@@ -3227,63 +2785,52 @@ var _Exporter = /** @class */ (function () {
|
|
|
3227
2785
|
* @param meshAttributeArray Array containing the attribute data
|
|
3228
2786
|
* @param stride Specifies the space between data
|
|
3229
2787
|
* @param binaryWriter The buffer to write the binary data to
|
|
3230
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3231
2788
|
* @param babylonTransformNode
|
|
3232
2789
|
*/
|
|
3233
|
-
_Exporter.prototype._writeAttributeData = function (vertexBufferKind, attributeComponentKind, meshAttributeArray, stride, binaryWriter,
|
|
2790
|
+
_Exporter.prototype._writeAttributeData = function (vertexBufferKind, attributeComponentKind, meshAttributeArray, stride, binaryWriter, babylonTransformNode) {
|
|
3234
2791
|
var vertexAttributes = [];
|
|
3235
2792
|
var index;
|
|
3236
2793
|
switch (vertexBufferKind) {
|
|
3237
|
-
case
|
|
2794
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind: {
|
|
3238
2795
|
for (var k = 0, length_2 = meshAttributeArray.length / stride; k < length_2; ++k) {
|
|
3239
2796
|
index = k * stride;
|
|
3240
|
-
var vertexData =
|
|
3241
|
-
if (convertToRightHandedSystem) {
|
|
3242
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3FromRef(vertexData);
|
|
3243
|
-
}
|
|
2797
|
+
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index);
|
|
3244
2798
|
vertexAttributes.push(vertexData.asArray());
|
|
3245
2799
|
}
|
|
3246
2800
|
break;
|
|
3247
2801
|
}
|
|
3248
|
-
case
|
|
2802
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
3249
2803
|
for (var k = 0, length_3 = meshAttributeArray.length / stride; k < length_3; ++k) {
|
|
3250
2804
|
index = k * stride;
|
|
3251
|
-
var vertexData =
|
|
3252
|
-
|
|
3253
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedNormalVector3FromRef(vertexData);
|
|
3254
|
-
}
|
|
3255
|
-
vertexData.normalize();
|
|
3256
|
-
vertexAttributes.push(vertexData.asArray());
|
|
2805
|
+
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index);
|
|
2806
|
+
vertexAttributes.push(vertexData.normalize().asArray());
|
|
3257
2807
|
}
|
|
3258
2808
|
break;
|
|
3259
2809
|
}
|
|
3260
|
-
case
|
|
2810
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
3261
2811
|
for (var k = 0, length_4 = meshAttributeArray.length / stride; k < length_4; ++k) {
|
|
3262
2812
|
index = k * stride;
|
|
3263
|
-
var vertexData =
|
|
3264
|
-
|
|
3265
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedVector4FromRef(vertexData);
|
|
3266
|
-
}
|
|
3267
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._NormalizeTangentFromRef(vertexData);
|
|
2813
|
+
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index);
|
|
2814
|
+
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._NormalizeTangentFromRef(vertexData);
|
|
3268
2815
|
vertexAttributes.push(vertexData.asArray());
|
|
3269
2816
|
}
|
|
3270
2817
|
break;
|
|
3271
2818
|
}
|
|
3272
|
-
case
|
|
2819
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind: {
|
|
3273
2820
|
var meshMaterial = babylonTransformNode.material;
|
|
3274
2821
|
var convertToLinear = meshMaterial ? meshMaterial.getClassName() === "StandardMaterial" : true;
|
|
3275
|
-
var vertexData = stride === 3 ? new
|
|
2822
|
+
var vertexData = stride === 3 ? new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3() : new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color4();
|
|
3276
2823
|
var useExactSrgbConversions = this._babylonScene.getEngine().useExactSrgbConversions;
|
|
3277
2824
|
for (var k = 0, length_5 = meshAttributeArray.length / stride; k < length_5; ++k) {
|
|
3278
2825
|
index = k * stride;
|
|
3279
2826
|
if (stride === 3) {
|
|
3280
|
-
|
|
2827
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.FromArrayToRef(meshAttributeArray, index, vertexData);
|
|
3281
2828
|
if (convertToLinear) {
|
|
3282
2829
|
vertexData.toLinearSpaceToRef(vertexData, useExactSrgbConversions);
|
|
3283
2830
|
}
|
|
3284
2831
|
}
|
|
3285
2832
|
else {
|
|
3286
|
-
|
|
2833
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color4.FromArrayToRef(meshAttributeArray, index, vertexData);
|
|
3287
2834
|
if (convertToLinear) {
|
|
3288
2835
|
vertexData.toLinearSpaceToRef(vertexData, useExactSrgbConversions);
|
|
3289
2836
|
}
|
|
@@ -3292,34 +2839,35 @@ var _Exporter = /** @class */ (function () {
|
|
|
3292
2839
|
}
|
|
3293
2840
|
break;
|
|
3294
2841
|
}
|
|
3295
|
-
case
|
|
3296
|
-
case
|
|
2842
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind:
|
|
2843
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind: {
|
|
3297
2844
|
for (var k = 0, length_6 = meshAttributeArray.length / stride; k < length_6; ++k) {
|
|
3298
2845
|
index = k * stride;
|
|
3299
|
-
|
|
2846
|
+
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2.FromArray(meshAttributeArray, index);
|
|
2847
|
+
vertexAttributes.push(vertexData.asArray());
|
|
3300
2848
|
}
|
|
3301
2849
|
break;
|
|
3302
2850
|
}
|
|
3303
|
-
case
|
|
3304
|
-
case
|
|
2851
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesKind:
|
|
2852
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesExtraKind: {
|
|
3305
2853
|
for (var k = 0, length_7 = meshAttributeArray.length / stride; k < length_7; ++k) {
|
|
3306
2854
|
index = k * stride;
|
|
3307
|
-
var vertexData =
|
|
2855
|
+
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index);
|
|
3308
2856
|
vertexAttributes.push(vertexData.asArray());
|
|
3309
2857
|
}
|
|
3310
2858
|
break;
|
|
3311
2859
|
}
|
|
3312
|
-
case
|
|
3313
|
-
case
|
|
2860
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsKind:
|
|
2861
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsExtraKind: {
|
|
3314
2862
|
for (var k = 0, length_8 = meshAttributeArray.length / stride; k < length_8; ++k) {
|
|
3315
2863
|
index = k * stride;
|
|
3316
|
-
var vertexData =
|
|
2864
|
+
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index);
|
|
3317
2865
|
vertexAttributes.push(vertexData.asArray());
|
|
3318
2866
|
}
|
|
3319
2867
|
break;
|
|
3320
2868
|
}
|
|
3321
2869
|
default: {
|
|
3322
|
-
|
|
2870
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported Vertex Buffer Type: " + vertexBufferKind);
|
|
3323
2871
|
vertexAttributes = [];
|
|
3324
2872
|
}
|
|
3325
2873
|
}
|
|
@@ -3342,7 +2890,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3342
2890
|
break;
|
|
3343
2891
|
}
|
|
3344
2892
|
default: {
|
|
3345
|
-
|
|
2893
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported Attribute Component kind: " + attributeComponentKind);
|
|
3346
2894
|
return;
|
|
3347
2895
|
}
|
|
3348
2896
|
}
|
|
@@ -3365,24 +2913,20 @@ var _Exporter = /** @class */ (function () {
|
|
|
3365
2913
|
* @param morphTargetAttributeArray
|
|
3366
2914
|
* @param stride Specifies the space between data
|
|
3367
2915
|
* @param binaryWriter The buffer to write the binary data to
|
|
3368
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3369
2916
|
* @param minMax
|
|
3370
2917
|
*/
|
|
3371
|
-
_Exporter.prototype.writeMorphTargetAttributeData = function (vertexBufferKind, attributeComponentKind, meshPrimitive,
|
|
2918
|
+
_Exporter.prototype.writeMorphTargetAttributeData = function (vertexBufferKind, attributeComponentKind, meshPrimitive, meshAttributeArray, morphTargetAttributeArray, stride, binaryWriter, minMax) {
|
|
3372
2919
|
var vertexAttributes = [];
|
|
3373
2920
|
var index;
|
|
3374
|
-
var difference = new
|
|
3375
|
-
var difference4 = new
|
|
2921
|
+
var difference = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3();
|
|
2922
|
+
var difference4 = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4(0, 0, 0, 0);
|
|
3376
2923
|
switch (vertexBufferKind) {
|
|
3377
|
-
case
|
|
2924
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind: {
|
|
3378
2925
|
for (var k = meshPrimitive.verticesStart; k < meshPrimitive.verticesCount; ++k) {
|
|
3379
2926
|
index = meshPrimitive.indexStart + k * stride;
|
|
3380
|
-
var vertexData =
|
|
3381
|
-
var morphData =
|
|
2927
|
+
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index);
|
|
2928
|
+
var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(morphTargetAttributeArray, index);
|
|
3382
2929
|
difference = morphData.subtractToRef(vertexData, difference);
|
|
3383
|
-
if (convertToRightHandedSystem) {
|
|
3384
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3FromRef(difference);
|
|
3385
|
-
}
|
|
3386
2930
|
if (minMax) {
|
|
3387
2931
|
minMax.min.copyFromFloats(Math.min(difference.x, minMax.min.x), Math.min(difference.y, minMax.min.y), Math.min(difference.z, minMax.min.z));
|
|
3388
2932
|
minMax.max.copyFromFloats(Math.max(difference.x, minMax.max.x), Math.max(difference.y, minMax.max.y), Math.max(difference.z, minMax.max.z));
|
|
@@ -3391,38 +2935,30 @@ var _Exporter = /** @class */ (function () {
|
|
|
3391
2935
|
}
|
|
3392
2936
|
break;
|
|
3393
2937
|
}
|
|
3394
|
-
case
|
|
2938
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
3395
2939
|
for (var k = meshPrimitive.verticesStart; k < meshPrimitive.verticesCount; ++k) {
|
|
3396
2940
|
index = meshPrimitive.indexStart + k * stride;
|
|
3397
|
-
var vertexData =
|
|
3398
|
-
|
|
3399
|
-
var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Vector3.FromArray(morphTargetAttributeArray, index);
|
|
3400
|
-
morphData.normalize();
|
|
2941
|
+
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(meshAttributeArray, index).normalize();
|
|
2942
|
+
var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(morphTargetAttributeArray, index).normalize();
|
|
3401
2943
|
difference = morphData.subtractToRef(vertexData, difference);
|
|
3402
|
-
if (convertToRightHandedSystem) {
|
|
3403
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedNormalVector3FromRef(difference);
|
|
3404
|
-
}
|
|
3405
2944
|
vertexAttributes.push(difference.asArray());
|
|
3406
2945
|
}
|
|
3407
2946
|
break;
|
|
3408
2947
|
}
|
|
3409
|
-
case
|
|
2948
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
3410
2949
|
for (var k = meshPrimitive.verticesStart; k < meshPrimitive.verticesCount; ++k) {
|
|
3411
2950
|
index = meshPrimitive.indexStart + k * (stride + 1);
|
|
3412
|
-
var vertexData =
|
|
3413
|
-
|
|
3414
|
-
var morphData =
|
|
3415
|
-
|
|
2951
|
+
var vertexData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(meshAttributeArray, index);
|
|
2952
|
+
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._NormalizeTangentFromRef(vertexData);
|
|
2953
|
+
var morphData = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector4.FromArray(morphTargetAttributeArray, index);
|
|
2954
|
+
_glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._NormalizeTangentFromRef(morphData);
|
|
3416
2955
|
difference4 = morphData.subtractToRef(vertexData, difference4);
|
|
3417
|
-
if (convertToRightHandedSystem) {
|
|
3418
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedVector4FromRef(difference4);
|
|
3419
|
-
}
|
|
3420
2956
|
vertexAttributes.push([difference4.x, difference4.y, difference4.z]);
|
|
3421
2957
|
}
|
|
3422
2958
|
break;
|
|
3423
2959
|
}
|
|
3424
2960
|
default: {
|
|
3425
|
-
|
|
2961
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported Vertex Buffer Type: " + vertexBufferKind);
|
|
3426
2962
|
vertexAttributes = [];
|
|
3427
2963
|
}
|
|
3428
2964
|
}
|
|
@@ -3445,7 +2981,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3445
2981
|
break;
|
|
3446
2982
|
}
|
|
3447
2983
|
default: {
|
|
3448
|
-
|
|
2984
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported Attribute Component kind: " + attributeComponentKind);
|
|
3449
2985
|
return;
|
|
3450
2986
|
}
|
|
3451
2987
|
}
|
|
@@ -3519,7 +3055,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3519
3055
|
imageData = _this._imageData[image.uri];
|
|
3520
3056
|
_this._orderedImageData.push(imageData);
|
|
3521
3057
|
imageName = image.uri.split(".")[0] + " image";
|
|
3522
|
-
bufferView =
|
|
3058
|
+
bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateBufferView(0, byteOffset, imageData.data.byteLength, undefined, imageName);
|
|
3523
3059
|
byteOffset += imageData.data.byteLength;
|
|
3524
3060
|
_this._bufferViews.push(bufferView);
|
|
3525
3061
|
image.bufferView = _this._bufferViews.length - 1;
|
|
@@ -3557,7 +3093,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3557
3093
|
var bin = new Blob([binaryBuffer], { type: "application/octet-stream" });
|
|
3558
3094
|
var glTFFileName = glTFPrefix + ".gltf";
|
|
3559
3095
|
var glTFBinFile = glTFPrefix + ".bin";
|
|
3560
|
-
var container = new
|
|
3096
|
+
var container = new _glTFData__WEBPACK_IMPORTED_MODULE_3__.GLTFData();
|
|
3561
3097
|
container.glTFFiles[glTFFileName] = jsonText;
|
|
3562
3098
|
container.glTFFiles[glTFBinFile] = bin;
|
|
3563
3099
|
if (_this._imageData) {
|
|
@@ -3578,7 +3114,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3578
3114
|
_Exporter.prototype._generateBinaryAsync = function () {
|
|
3579
3115
|
var _this = this;
|
|
3580
3116
|
var binaryWriter = new _BinaryWriter(4);
|
|
3581
|
-
return this._createSceneAsync(
|
|
3117
|
+
return this._createSceneAsync(binaryWriter).then(function () {
|
|
3582
3118
|
if (_this._localEngine) {
|
|
3583
3119
|
_this._localEngine.dispose();
|
|
3584
3120
|
}
|
|
@@ -3682,7 +3218,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
3682
3218
|
glbData.push(binPaddingBuffer);
|
|
3683
3219
|
glbData.push(imagePaddingBuffer);
|
|
3684
3220
|
var glbFile = new Blob(glbData, { type: "application/octet-stream" });
|
|
3685
|
-
var container = new
|
|
3221
|
+
var container = new _glTFData__WEBPACK_IMPORTED_MODULE_3__.GLTFData();
|
|
3686
3222
|
container.glTFFiles[glbFileName] = glbFile;
|
|
3687
3223
|
if (_this._localEngine != null) {
|
|
3688
3224
|
_this._localEngine.dispose();
|
|
@@ -3697,40 +3233,31 @@ var _Exporter = /** @class */ (function () {
|
|
|
3697
3233
|
* Sets the TRS for each node
|
|
3698
3234
|
* @param node glTF Node for storing the transformation data
|
|
3699
3235
|
* @param babylonTransformNode Babylon mesh used as the source for the transformation data
|
|
3700
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3701
3236
|
*/
|
|
3702
|
-
_Exporter.prototype._setNodeTransformation = function (node, babylonTransformNode
|
|
3237
|
+
_Exporter.prototype._setNodeTransformation = function (node, babylonTransformNode) {
|
|
3703
3238
|
if (!babylonTransformNode.getPivotPoint().equalsToFloats(0, 0, 0)) {
|
|
3704
|
-
|
|
3239
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Pivot points are not supported in the glTF serializer");
|
|
3705
3240
|
}
|
|
3706
3241
|
if (!babylonTransformNode.position.equalsToFloats(0, 0, 0)) {
|
|
3707
|
-
node.translation =
|
|
3708
|
-
? _glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedPositionVector3(babylonTransformNode.position).asArray()
|
|
3709
|
-
: babylonTransformNode.position.asArray();
|
|
3242
|
+
node.translation = babylonTransformNode.position.asArray();
|
|
3710
3243
|
}
|
|
3711
3244
|
if (!babylonTransformNode.scaling.equalsToFloats(1, 1, 1)) {
|
|
3712
3245
|
node.scale = babylonTransformNode.scaling.asArray();
|
|
3713
3246
|
}
|
|
3714
|
-
var rotationQuaternion =
|
|
3247
|
+
var rotationQuaternion = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.RotationYawPitchRoll(babylonTransformNode.rotation.y, babylonTransformNode.rotation.x, babylonTransformNode.rotation.z);
|
|
3715
3248
|
if (babylonTransformNode.rotationQuaternion) {
|
|
3716
3249
|
rotationQuaternion.multiplyInPlace(babylonTransformNode.rotationQuaternion);
|
|
3717
3250
|
}
|
|
3718
|
-
if (!
|
|
3719
|
-
if (convertToRightHandedSystem) {
|
|
3720
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);
|
|
3721
|
-
}
|
|
3251
|
+
if (!core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(rotationQuaternion)) {
|
|
3722
3252
|
node.rotation = rotationQuaternion.normalize().asArray();
|
|
3723
3253
|
}
|
|
3724
3254
|
};
|
|
3725
|
-
_Exporter.prototype._setCameraTransformation = function (node, babylonCamera
|
|
3255
|
+
_Exporter.prototype._setCameraTransformation = function (node, babylonCamera) {
|
|
3726
3256
|
if (!babylonCamera.position.equalsToFloats(0, 0, 0)) {
|
|
3727
|
-
node.translation =
|
|
3257
|
+
node.translation = babylonCamera.position.asArray();
|
|
3728
3258
|
}
|
|
3729
3259
|
var rotationQuaternion = babylonCamera.rotationQuaternion; // we target the local transformation if one.
|
|
3730
|
-
if (rotationQuaternion && !
|
|
3731
|
-
if (convertToRightHandedSystem) {
|
|
3732
|
-
_glTFUtilities__WEBPACK_IMPORTED_MODULE_3__._GLTFUtilities._GetRightHandedQuaternionFromRef(rotationQuaternion);
|
|
3733
|
-
}
|
|
3260
|
+
if (rotationQuaternion && !core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Quaternion.IsIdentity(rotationQuaternion)) {
|
|
3734
3261
|
node.rotation = rotationQuaternion.normalize().asArray();
|
|
3735
3262
|
}
|
|
3736
3263
|
};
|
|
@@ -3750,23 +3277,22 @@ var _Exporter = /** @class */ (function () {
|
|
|
3750
3277
|
* @param babylonTransformNode The Babylon mesh to get the vertices data from
|
|
3751
3278
|
* @param binaryWriter The buffer to write the bufferview data to
|
|
3752
3279
|
* @param byteStride
|
|
3753
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3754
3280
|
*/
|
|
3755
|
-
_Exporter.prototype._createBufferViewKind = function (kind, attributeComponentKind, babylonTransformNode, binaryWriter, byteStride
|
|
3756
|
-
var bufferMesh = babylonTransformNode instanceof
|
|
3281
|
+
_Exporter.prototype._createBufferViewKind = function (kind, attributeComponentKind, babylonTransformNode, binaryWriter, byteStride) {
|
|
3282
|
+
var bufferMesh = babylonTransformNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh
|
|
3757
3283
|
? babylonTransformNode
|
|
3758
|
-
: babylonTransformNode instanceof
|
|
3284
|
+
: babylonTransformNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.InstancedMesh
|
|
3759
3285
|
? babylonTransformNode.sourceMesh
|
|
3760
3286
|
: null;
|
|
3761
3287
|
if (bufferMesh) {
|
|
3762
3288
|
var vertexBuffer = bufferMesh.getVertexBuffer(kind, true);
|
|
3763
3289
|
var vertexData = bufferMesh.getVerticesData(kind, undefined, undefined, true);
|
|
3764
3290
|
if (vertexBuffer && vertexData) {
|
|
3765
|
-
var typeByteLength =
|
|
3291
|
+
var typeByteLength = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.GetTypeByteLength(attributeComponentKind);
|
|
3766
3292
|
var byteLength = vertexData.length * typeByteLength;
|
|
3767
|
-
var bufferView =
|
|
3293
|
+
var bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, kind + " - " + bufferMesh.name);
|
|
3768
3294
|
this._bufferViews.push(bufferView);
|
|
3769
|
-
this._writeAttributeData(kind, attributeComponentKind, vertexData, byteStride / typeByteLength, binaryWriter,
|
|
3295
|
+
this._writeAttributeData(kind, attributeComponentKind, vertexData, byteStride / typeByteLength, binaryWriter, babylonTransformNode);
|
|
3770
3296
|
}
|
|
3771
3297
|
}
|
|
3772
3298
|
};
|
|
@@ -3776,9 +3302,8 @@ var _Exporter = /** @class */ (function () {
|
|
|
3776
3302
|
* @param meshPrimitive
|
|
3777
3303
|
* @param babylonMorphTarget the morph target to be exported
|
|
3778
3304
|
* @param binaryWriter The buffer to write the bufferview data to
|
|
3779
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3780
3305
|
*/
|
|
3781
|
-
_Exporter.prototype._setMorphTargetAttributes = function (babylonSubMesh, meshPrimitive, babylonMorphTarget, binaryWriter
|
|
3306
|
+
_Exporter.prototype._setMorphTargetAttributes = function (babylonSubMesh, meshPrimitive, babylonMorphTarget, binaryWriter) {
|
|
3782
3307
|
if (babylonMorphTarget) {
|
|
3783
3308
|
if (!meshPrimitive.targets) {
|
|
3784
3309
|
meshPrimitive.targets = [];
|
|
@@ -3786,49 +3311,49 @@ var _Exporter = /** @class */ (function () {
|
|
|
3786
3311
|
var target = {};
|
|
3787
3312
|
var mesh = babylonSubMesh.getMesh();
|
|
3788
3313
|
if (babylonMorphTarget.hasNormals) {
|
|
3789
|
-
var vertexNormals = mesh.getVerticesData(
|
|
3314
|
+
var vertexNormals = mesh.getVerticesData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind, undefined, undefined, true);
|
|
3790
3315
|
var morphNormals = babylonMorphTarget.getNormals();
|
|
3791
3316
|
var count = babylonSubMesh.verticesCount;
|
|
3792
3317
|
var byteStride = 12; // 3 x 4 byte floats
|
|
3793
3318
|
var byteLength = count * byteStride;
|
|
3794
|
-
var bufferView =
|
|
3319
|
+
var bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, babylonMorphTarget.name + "_NORMAL");
|
|
3795
3320
|
this._bufferViews.push(bufferView);
|
|
3796
3321
|
var bufferViewIndex = this._bufferViews.length - 1;
|
|
3797
|
-
var accessor =
|
|
3322
|
+
var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "NORMAL", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
|
3798
3323
|
this._accessors.push(accessor);
|
|
3799
3324
|
target.NORMAL = this._accessors.length - 1;
|
|
3800
|
-
this.writeMorphTargetAttributeData(
|
|
3325
|
+
this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexNormals, morphNormals, byteStride / 4, binaryWriter);
|
|
3801
3326
|
}
|
|
3802
3327
|
if (babylonMorphTarget.hasPositions) {
|
|
3803
|
-
var vertexPositions = mesh.getVerticesData(
|
|
3328
|
+
var vertexPositions = mesh.getVerticesData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind, undefined, undefined, true);
|
|
3804
3329
|
var morphPositions = babylonMorphTarget.getPositions();
|
|
3805
3330
|
var count = babylonSubMesh.verticesCount;
|
|
3806
3331
|
var byteStride = 12; // 3 x 4 byte floats
|
|
3807
3332
|
var byteLength = count * byteStride;
|
|
3808
|
-
var bufferView =
|
|
3333
|
+
var bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, babylonMorphTarget.name + "_POSITION");
|
|
3809
3334
|
this._bufferViews.push(bufferView);
|
|
3810
3335
|
var bufferViewIndex = this._bufferViews.length - 1;
|
|
3811
|
-
var minMax = { min: new
|
|
3812
|
-
var accessor =
|
|
3336
|
+
var minMax = { min: new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(Infinity, Infinity, Infinity), max: new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(-Infinity, -Infinity, -Infinity) };
|
|
3337
|
+
var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "POSITION", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
|
3813
3338
|
this._accessors.push(accessor);
|
|
3814
3339
|
target.POSITION = this._accessors.length - 1;
|
|
3815
|
-
this.writeMorphTargetAttributeData(
|
|
3340
|
+
this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexPositions, morphPositions, byteStride / 4, binaryWriter, minMax);
|
|
3816
3341
|
accessor.min = minMax.min.asArray();
|
|
3817
3342
|
accessor.max = minMax.max.asArray();
|
|
3818
3343
|
}
|
|
3819
3344
|
if (babylonMorphTarget.hasTangents) {
|
|
3820
|
-
var vertexTangents = mesh.getVerticesData(
|
|
3345
|
+
var vertexTangents = mesh.getVerticesData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind, undefined, undefined, true);
|
|
3821
3346
|
var morphTangents = babylonMorphTarget.getTangents();
|
|
3822
3347
|
var count = babylonSubMesh.verticesCount;
|
|
3823
3348
|
var byteStride = 12; // 3 x 4 byte floats
|
|
3824
3349
|
var byteLength = count * byteStride;
|
|
3825
|
-
var bufferView =
|
|
3350
|
+
var bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, byteStride, babylonMorphTarget.name + "_NORMAL");
|
|
3826
3351
|
this._bufferViews.push(bufferView);
|
|
3827
3352
|
var bufferViewIndex = this._bufferViews.length - 1;
|
|
3828
|
-
var accessor =
|
|
3353
|
+
var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateAccessor(bufferViewIndex, babylonMorphTarget.name + " - " + "TANGENT", "VEC3" /* AccessorType.VEC3 */, 5126 /* AccessorComponentType.FLOAT */, count, 0, null, null);
|
|
3829
3354
|
this._accessors.push(accessor);
|
|
3830
3355
|
target.TANGENT = this._accessors.length - 1;
|
|
3831
|
-
this.writeMorphTargetAttributeData(
|
|
3356
|
+
this.writeMorphTargetAttributeData(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind, 5126 /* AccessorComponentType.FLOAT */, babylonSubMesh, vertexTangents, morphTangents, byteStride / 4, binaryWriter);
|
|
3832
3357
|
}
|
|
3833
3358
|
meshPrimitive.targets.push(target);
|
|
3834
3359
|
}
|
|
@@ -3838,16 +3363,16 @@ var _Exporter = /** @class */ (function () {
|
|
|
3838
3363
|
* @param babylonMesh The BabylonJS mesh
|
|
3839
3364
|
*/
|
|
3840
3365
|
_Exporter.prototype._getMeshPrimitiveMode = function (babylonMesh) {
|
|
3841
|
-
if (babylonMesh instanceof
|
|
3842
|
-
return
|
|
3366
|
+
if (babylonMesh instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.LinesMesh) {
|
|
3367
|
+
return core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.LineListDrawMode;
|
|
3843
3368
|
}
|
|
3844
|
-
if (babylonMesh instanceof
|
|
3845
|
-
var baseMesh = babylonMesh instanceof
|
|
3369
|
+
if (babylonMesh instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.InstancedMesh || babylonMesh instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
|
|
3370
|
+
var baseMesh = babylonMesh instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh ? babylonMesh : babylonMesh.sourceMesh;
|
|
3846
3371
|
if (typeof baseMesh.overrideRenderingFillMode === "number") {
|
|
3847
3372
|
return baseMesh.overrideRenderingFillMode;
|
|
3848
3373
|
}
|
|
3849
3374
|
}
|
|
3850
|
-
return babylonMesh.material ? babylonMesh.material.fillMode :
|
|
3375
|
+
return babylonMesh.material ? babylonMesh.material.fillMode : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFillMode;
|
|
3851
3376
|
};
|
|
3852
3377
|
/**
|
|
3853
3378
|
* Sets the primitive mode of the glTF mesh primitive
|
|
@@ -3856,35 +3381,35 @@ var _Exporter = /** @class */ (function () {
|
|
|
3856
3381
|
*/
|
|
3857
3382
|
_Exporter.prototype._setPrimitiveMode = function (meshPrimitive, primitiveMode) {
|
|
3858
3383
|
switch (primitiveMode) {
|
|
3859
|
-
case
|
|
3384
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFillMode: {
|
|
3860
3385
|
// glTF defaults to using Triangle Mode
|
|
3861
3386
|
break;
|
|
3862
3387
|
}
|
|
3863
|
-
case
|
|
3388
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleStripDrawMode: {
|
|
3864
3389
|
meshPrimitive.mode = 5 /* MeshPrimitiveMode.TRIANGLE_STRIP */;
|
|
3865
3390
|
break;
|
|
3866
3391
|
}
|
|
3867
|
-
case
|
|
3392
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.TriangleFanDrawMode: {
|
|
3868
3393
|
meshPrimitive.mode = 6 /* MeshPrimitiveMode.TRIANGLE_FAN */;
|
|
3869
3394
|
break;
|
|
3870
3395
|
}
|
|
3871
|
-
case
|
|
3396
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.PointListDrawMode: {
|
|
3872
3397
|
meshPrimitive.mode = 0 /* MeshPrimitiveMode.POINTS */;
|
|
3873
3398
|
break;
|
|
3874
3399
|
}
|
|
3875
|
-
case
|
|
3400
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.PointFillMode: {
|
|
3876
3401
|
meshPrimitive.mode = 0 /* MeshPrimitiveMode.POINTS */;
|
|
3877
3402
|
break;
|
|
3878
3403
|
}
|
|
3879
|
-
case
|
|
3404
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.LineLoopDrawMode: {
|
|
3880
3405
|
meshPrimitive.mode = 2 /* MeshPrimitiveMode.LINE_LOOP */;
|
|
3881
3406
|
break;
|
|
3882
3407
|
}
|
|
3883
|
-
case
|
|
3408
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.LineListDrawMode: {
|
|
3884
3409
|
meshPrimitive.mode = 1 /* MeshPrimitiveMode.LINES */;
|
|
3885
3410
|
break;
|
|
3886
3411
|
}
|
|
3887
|
-
case
|
|
3412
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.LineStripDrawMode: {
|
|
3888
3413
|
meshPrimitive.mode = 3 /* MeshPrimitiveMode.LINE_STRIP */;
|
|
3889
3414
|
break;
|
|
3890
3415
|
}
|
|
@@ -3898,48 +3423,48 @@ var _Exporter = /** @class */ (function () {
|
|
|
3898
3423
|
*/
|
|
3899
3424
|
_Exporter.prototype._setAttributeKind = function (meshPrimitive, attributeKind) {
|
|
3900
3425
|
switch (attributeKind) {
|
|
3901
|
-
case
|
|
3426
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind: {
|
|
3902
3427
|
meshPrimitive.attributes.POSITION = this._accessors.length - 1;
|
|
3903
3428
|
break;
|
|
3904
3429
|
}
|
|
3905
|
-
case
|
|
3430
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind: {
|
|
3906
3431
|
meshPrimitive.attributes.NORMAL = this._accessors.length - 1;
|
|
3907
3432
|
break;
|
|
3908
3433
|
}
|
|
3909
|
-
case
|
|
3434
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind: {
|
|
3910
3435
|
meshPrimitive.attributes.COLOR_0 = this._accessors.length - 1;
|
|
3911
3436
|
break;
|
|
3912
3437
|
}
|
|
3913
|
-
case
|
|
3438
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind: {
|
|
3914
3439
|
meshPrimitive.attributes.TANGENT = this._accessors.length - 1;
|
|
3915
3440
|
break;
|
|
3916
3441
|
}
|
|
3917
|
-
case
|
|
3442
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind: {
|
|
3918
3443
|
meshPrimitive.attributes.TEXCOORD_0 = this._accessors.length - 1;
|
|
3919
3444
|
break;
|
|
3920
3445
|
}
|
|
3921
|
-
case
|
|
3446
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind: {
|
|
3922
3447
|
meshPrimitive.attributes.TEXCOORD_1 = this._accessors.length - 1;
|
|
3923
3448
|
break;
|
|
3924
3449
|
}
|
|
3925
|
-
case
|
|
3450
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesKind: {
|
|
3926
3451
|
meshPrimitive.attributes.JOINTS_0 = this._accessors.length - 1;
|
|
3927
3452
|
break;
|
|
3928
3453
|
}
|
|
3929
|
-
case
|
|
3454
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesExtraKind: {
|
|
3930
3455
|
meshPrimitive.attributes.JOINTS_1 = this._accessors.length - 1;
|
|
3931
3456
|
break;
|
|
3932
3457
|
}
|
|
3933
|
-
case
|
|
3458
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsKind: {
|
|
3934
3459
|
meshPrimitive.attributes.WEIGHTS_0 = this._accessors.length - 1;
|
|
3935
3460
|
break;
|
|
3936
3461
|
}
|
|
3937
|
-
case
|
|
3462
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsExtraKind: {
|
|
3938
3463
|
meshPrimitive.attributes.WEIGHTS_1 = this._accessors.length - 1;
|
|
3939
3464
|
break;
|
|
3940
3465
|
}
|
|
3941
3466
|
default: {
|
|
3942
|
-
|
|
3467
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported Vertex Buffer Type: " + attributeKind);
|
|
3943
3468
|
}
|
|
3944
3469
|
}
|
|
3945
3470
|
};
|
|
@@ -3948,31 +3473,29 @@ var _Exporter = /** @class */ (function () {
|
|
|
3948
3473
|
* @param mesh glTF Mesh object to store the primitive attribute information
|
|
3949
3474
|
* @param babylonTransformNode Babylon mesh to get the primitive attribute data from
|
|
3950
3475
|
* @param binaryWriter Buffer to write the attribute data to
|
|
3951
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
3952
3476
|
*/
|
|
3953
|
-
_Exporter.prototype._setPrimitiveAttributesAsync = function (mesh, babylonTransformNode, binaryWriter
|
|
3954
|
-
var _a;
|
|
3477
|
+
_Exporter.prototype._setPrimitiveAttributesAsync = function (mesh, babylonTransformNode, binaryWriter) {
|
|
3955
3478
|
var promises = [];
|
|
3956
3479
|
var bufferMesh = null;
|
|
3957
3480
|
var bufferView;
|
|
3958
3481
|
var minMax;
|
|
3959
|
-
if (babylonTransformNode instanceof
|
|
3482
|
+
if (babylonTransformNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
|
|
3960
3483
|
bufferMesh = babylonTransformNode;
|
|
3961
3484
|
}
|
|
3962
|
-
else if (babylonTransformNode instanceof
|
|
3485
|
+
else if (babylonTransformNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.InstancedMesh) {
|
|
3963
3486
|
bufferMesh = babylonTransformNode.sourceMesh;
|
|
3964
3487
|
}
|
|
3965
3488
|
var attributeData = [
|
|
3966
|
-
{ kind:
|
|
3967
|
-
{ kind:
|
|
3968
|
-
{ kind:
|
|
3969
|
-
{ kind:
|
|
3970
|
-
{ kind:
|
|
3971
|
-
{ kind:
|
|
3972
|
-
{ kind:
|
|
3973
|
-
{ kind:
|
|
3974
|
-
{ kind:
|
|
3975
|
-
{ kind:
|
|
3489
|
+
{ kind: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind, accessorType: "VEC3" /* AccessorType.VEC3 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 12 },
|
|
3490
|
+
{ kind: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind, accessorType: "VEC3" /* AccessorType.VEC3 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 12 },
|
|
3491
|
+
{ kind: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
|
3492
|
+
{ kind: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.TangentKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
|
3493
|
+
{ kind: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind, accessorType: "VEC2" /* AccessorType.VEC2 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 8 },
|
|
3494
|
+
{ kind: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind, accessorType: "VEC2" /* AccessorType.VEC2 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 8 },
|
|
3495
|
+
{ kind: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5123 /* AccessorComponentType.UNSIGNED_SHORT */, byteStride: 8 },
|
|
3496
|
+
{ kind: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesExtraKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5123 /* AccessorComponentType.UNSIGNED_SHORT */, byteStride: 8 },
|
|
3497
|
+
{ kind: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
|
3498
|
+
{ kind: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesWeightsExtraKind, accessorType: "VEC4" /* AccessorType.VEC4 */, accessorComponentType: 5126 /* AccessorComponentType.FLOAT */, byteStride: 16 },
|
|
3976
3499
|
];
|
|
3977
3500
|
if (bufferMesh) {
|
|
3978
3501
|
var indexBufferViewIndex = null;
|
|
@@ -3987,12 +3510,12 @@ var _Exporter = /** @class */ (function () {
|
|
|
3987
3510
|
if (bufferMesh.isVerticesDataPresent(attributeKind, true)) {
|
|
3988
3511
|
var vertexBuffer = this._getVertexBufferFromMesh(attributeKind, bufferMesh);
|
|
3989
3512
|
attribute.byteStride = vertexBuffer
|
|
3990
|
-
? vertexBuffer.getSize() *
|
|
3991
|
-
:
|
|
3513
|
+
? vertexBuffer.getSize() * core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.GetTypeByteLength(attribute.accessorComponentType)
|
|
3514
|
+
: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.DeduceStride(attributeKind) * 4;
|
|
3992
3515
|
if (attribute.byteStride === 12) {
|
|
3993
3516
|
attribute.accessorType = "VEC3" /* AccessorType.VEC3 */;
|
|
3994
3517
|
}
|
|
3995
|
-
this._createBufferViewKind(attributeKind, attributeComponentKind, babylonTransformNode, binaryWriter, attribute.byteStride
|
|
3518
|
+
this._createBufferViewKind(attributeKind, attributeComponentKind, babylonTransformNode, binaryWriter, attribute.byteStride);
|
|
3996
3519
|
attribute.bufferViewIndex = this._bufferViews.length - 1;
|
|
3997
3520
|
vertexAttributeBufferViews[attributeKind] = attribute.bufferViewIndex;
|
|
3998
3521
|
}
|
|
@@ -4001,7 +3524,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4001
3524
|
var indices = bufferMesh.getIndices();
|
|
4002
3525
|
if (indices) {
|
|
4003
3526
|
var byteLength = indices.length * 4;
|
|
4004
|
-
bufferView =
|
|
3527
|
+
bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateBufferView(0, binaryWriter.getByteOffset(), byteLength, undefined, "Indices - " + bufferMesh.name);
|
|
4005
3528
|
this._bufferViews.push(bufferView);
|
|
4006
3529
|
indexBufferViewIndex = this._bufferViews.length - 1;
|
|
4007
3530
|
for (var k = 0, length_9 = indices.length; k < length_9; ++k) {
|
|
@@ -4011,17 +3534,17 @@ var _Exporter = /** @class */ (function () {
|
|
|
4011
3534
|
}
|
|
4012
3535
|
if (bufferMesh.subMeshes) {
|
|
4013
3536
|
// go through all mesh primitives (submeshes)
|
|
4014
|
-
for (var
|
|
4015
|
-
var submesh =
|
|
3537
|
+
for (var _a = 0, _b = bufferMesh.subMeshes; _a < _b.length; _a++) {
|
|
3538
|
+
var submesh = _b[_a];
|
|
4016
3539
|
var babylonMaterial = submesh.getMaterial() || bufferMesh.getScene().defaultMaterial;
|
|
4017
3540
|
var materialIndex = null;
|
|
4018
3541
|
if (babylonMaterial) {
|
|
4019
|
-
if (bufferMesh instanceof
|
|
3542
|
+
if (bufferMesh instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.LinesMesh) {
|
|
4020
3543
|
// get the color from the lines mesh and set it in the material
|
|
4021
3544
|
var material = {
|
|
4022
3545
|
name: bufferMesh.name + " material",
|
|
4023
3546
|
};
|
|
4024
|
-
if (!bufferMesh.color.equals(
|
|
3547
|
+
if (!bufferMesh.color.equals(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White()) || bufferMesh.alpha < 1) {
|
|
4025
3548
|
material.pbrMetallicRoughness = {
|
|
4026
3549
|
baseColorFactor: bufferMesh.color.asArray().concat([bufferMesh.alpha]),
|
|
4027
3550
|
};
|
|
@@ -4029,7 +3552,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4029
3552
|
this._materials.push(material);
|
|
4030
3553
|
materialIndex = this._materials.length - 1;
|
|
4031
3554
|
}
|
|
4032
|
-
else if (babylonMaterial instanceof
|
|
3555
|
+
else if (babylonMaterial instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.MultiMaterial) {
|
|
4033
3556
|
var subMaterial = babylonMaterial.subMaterials[submesh.materialIndex];
|
|
4034
3557
|
if (subMaterial) {
|
|
4035
3558
|
babylonMaterial = subMaterial;
|
|
@@ -4043,10 +3566,10 @@ var _Exporter = /** @class */ (function () {
|
|
|
4043
3566
|
var glTFMaterial = materialIndex != null ? this._materials[materialIndex] : null;
|
|
4044
3567
|
var meshPrimitive = { attributes: {} };
|
|
4045
3568
|
this._setPrimitiveMode(meshPrimitive, primitiveMode);
|
|
4046
|
-
for (var
|
|
4047
|
-
var attribute = attributeData_2[
|
|
3569
|
+
for (var _c = 0, attributeData_2 = attributeData; _c < attributeData_2.length; _c++) {
|
|
3570
|
+
var attribute = attributeData_2[_c];
|
|
4048
3571
|
var attributeKind = attribute.kind;
|
|
4049
|
-
if ((attributeKind ===
|
|
3572
|
+
if ((attributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind || attributeKind === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind) && !this._options.exportUnusedUVs) {
|
|
4050
3573
|
if (!glTFMaterial || !this._glTFMaterialExporter._hasTexturesPresent(glTFMaterial)) {
|
|
4051
3574
|
continue;
|
|
4052
3575
|
}
|
|
@@ -4060,10 +3583,10 @@ var _Exporter = /** @class */ (function () {
|
|
|
4060
3583
|
if (bufferViewIndex != undefined) {
|
|
4061
3584
|
// check to see if bufferviewindex has a numeric value assigned.
|
|
4062
3585
|
minMax = { min: null, max: null };
|
|
4063
|
-
if (attributeKind ==
|
|
4064
|
-
minMax =
|
|
3586
|
+
if (attributeKind == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind) {
|
|
3587
|
+
minMax = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CalculateMinMaxPositions(vertexData, 0, vertexData.length / stride);
|
|
4065
3588
|
}
|
|
4066
|
-
var accessor =
|
|
3589
|
+
var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateAccessor(bufferViewIndex, attributeKind + " - " + babylonTransformNode.name, attribute.accessorType, attribute.accessorComponentType, vertexData.length / stride, 0, minMax.min, minMax.max);
|
|
4067
3590
|
this._accessors.push(accessor);
|
|
4068
3591
|
this._setAttributeKind(meshPrimitive, attributeKind);
|
|
4069
3592
|
}
|
|
@@ -4072,16 +3595,13 @@ var _Exporter = /** @class */ (function () {
|
|
|
4072
3595
|
}
|
|
4073
3596
|
if (indexBufferViewIndex) {
|
|
4074
3597
|
// Create accessor
|
|
4075
|
-
var accessor =
|
|
3598
|
+
var accessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateAccessor(indexBufferViewIndex, "indices - " + babylonTransformNode.name, "SCALAR" /* AccessorType.SCALAR */, 5125 /* AccessorComponentType.UNSIGNED_INT */, submesh.indexCount, submesh.indexStart * 4, null, null);
|
|
4076
3599
|
this._accessors.push(accessor);
|
|
4077
3600
|
meshPrimitive.indices = this._accessors.length - 1;
|
|
4078
3601
|
}
|
|
4079
3602
|
if (materialIndex != null && Object.keys(meshPrimitive.attributes).length > 0) {
|
|
4080
3603
|
var sideOrientation = bufferMesh.overrideMaterialSideOrientation !== null ? bufferMesh.overrideMaterialSideOrientation : babylonMaterial.sideOrientation;
|
|
4081
|
-
if (
|
|
4082
|
-
(sideOrientation == core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Material.ClockWiseSideOrientation &&
|
|
4083
|
-
convertToRightHandedSystem &&
|
|
4084
|
-
bufferMesh.overrideMaterialSideOrientation !== ((_a = bufferMesh.material) === null || _a === void 0 ? void 0 : _a.sideOrientation))) {
|
|
3604
|
+
if (sideOrientation === (this._babylonScene.useRightHandedSystem ? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.ClockWiseSideOrientation : core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Material.CounterClockWiseSideOrientation)) {
|
|
4085
3605
|
var byteOffset = indexBufferViewIndex != null ? this._bufferViews[indexBufferViewIndex].byteOffset : null;
|
|
4086
3606
|
if (byteOffset == null) {
|
|
4087
3607
|
byteOffset = 0;
|
|
@@ -4094,15 +3614,12 @@ var _Exporter = /** @class */ (function () {
|
|
|
4094
3614
|
this._reorderIndicesBasedOnPrimitiveMode(submesh, primitiveMode, babylonIndices, byteOffset, binaryWriter);
|
|
4095
3615
|
}
|
|
4096
3616
|
else {
|
|
4097
|
-
for (var
|
|
4098
|
-
var attribute = attributeData_3[
|
|
3617
|
+
for (var _d = 0, attributeData_3 = attributeData; _d < attributeData_3.length; _d++) {
|
|
3618
|
+
var attribute = attributeData_3[_d];
|
|
4099
3619
|
var vertexData = bufferMesh.getVerticesData(attribute.kind, undefined, undefined, true);
|
|
4100
3620
|
if (vertexData) {
|
|
4101
|
-
var byteOffset_1 = this._bufferViews[vertexAttributeBufferViews[attribute.kind]].byteOffset;
|
|
4102
|
-
|
|
4103
|
-
byteOffset_1 = 0;
|
|
4104
|
-
}
|
|
4105
|
-
this._reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, sideOrientation, attribute.kind, vertexData, byteOffset_1, binaryWriter, convertToRightHandedSystem);
|
|
3621
|
+
var byteOffset_1 = this._bufferViews[vertexAttributeBufferViews[attribute.kind]].byteOffset || 0;
|
|
3622
|
+
this._reorderVertexAttributeDataBasedOnPrimitiveMode(submesh, primitiveMode, attribute.kind, vertexData, byteOffset_1, binaryWriter);
|
|
4106
3623
|
}
|
|
4107
3624
|
}
|
|
4108
3625
|
}
|
|
@@ -4113,7 +3630,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4113
3630
|
var target = void 0;
|
|
4114
3631
|
for (var i = 0; i < morphTargetManager.numTargets; ++i) {
|
|
4115
3632
|
target = morphTargetManager.getTarget(i);
|
|
4116
|
-
this._setMorphTargetAttributes(submesh, meshPrimitive, target, binaryWriter
|
|
3633
|
+
this._setMorphTargetAttributes(submesh, meshPrimitive, target, binaryWriter);
|
|
4117
3634
|
}
|
|
4118
3635
|
}
|
|
4119
3636
|
mesh.primitives.push(meshPrimitive);
|
|
@@ -4126,83 +3643,47 @@ var _Exporter = /** @class */ (function () {
|
|
|
4126
3643
|
/* do nothing */
|
|
4127
3644
|
});
|
|
4128
3645
|
};
|
|
4129
|
-
/**
|
|
4130
|
-
* Check if the node is used to convert its descendants from a right handed coordinate system to the Babylon scene's coordinate system.
|
|
4131
|
-
* @param node The node to check
|
|
4132
|
-
* @returns True if the node is used to convert its descendants from right-handed to left-handed. False otherwise
|
|
4133
|
-
*/
|
|
4134
|
-
_Exporter.prototype._isBabylonCoordinateSystemConvertingNode = function (node) {
|
|
4135
|
-
if (node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TransformNode) {
|
|
4136
|
-
// Transform
|
|
4137
|
-
var matrix = node.getWorldMatrix().multiplyToRef(convertHandednessMatrix, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.TmpVectors.Matrix[0]);
|
|
4138
|
-
if (!matrix.isIdentity()) {
|
|
4139
|
-
return false;
|
|
4140
|
-
}
|
|
4141
|
-
// Geometry
|
|
4142
|
-
if ((node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Mesh && node.geometry !== null) || (node instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.InstancedMesh && node.sourceMesh.geometry !== null)) {
|
|
4143
|
-
return false;
|
|
4144
|
-
}
|
|
4145
|
-
return true;
|
|
4146
|
-
}
|
|
4147
|
-
return false;
|
|
4148
|
-
};
|
|
4149
3646
|
/**
|
|
4150
3647
|
* Creates a glTF scene based on the array of meshes
|
|
4151
3648
|
* Returns the the total byte offset
|
|
4152
3649
|
* @param babylonScene Babylon scene to get the mesh data from
|
|
4153
3650
|
* @param binaryWriter Buffer to write binary data to
|
|
4154
3651
|
*/
|
|
4155
|
-
_Exporter.prototype._createSceneAsync = function (
|
|
3652
|
+
_Exporter.prototype._createSceneAsync = function (binaryWriter) {
|
|
4156
3653
|
var _this = this;
|
|
3654
|
+
var _a;
|
|
4157
3655
|
var scene = { nodes: [] };
|
|
4158
3656
|
var glTFNodeIndex;
|
|
4159
3657
|
var glTFNode;
|
|
4160
3658
|
var directDescendents;
|
|
4161
|
-
var nodes = (0,
|
|
4162
|
-
var
|
|
4163
|
-
this._convertToRightHandedSystem = !babylonScene.useRightHandedSystem;
|
|
4164
|
-
this._convertToRightHandedSystemMap = {};
|
|
3659
|
+
var nodes = (0,tslib__WEBPACK_IMPORTED_MODULE_5__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__spreadArray)((0,tslib__WEBPACK_IMPORTED_MODULE_5__.__spreadArray)([], this._babylonScene.transformNodes, true), this._babylonScene.meshes, true), this._babylonScene.lights, true), this._babylonScene.cameras, true);
|
|
3660
|
+
var removedRootNodes = new Set();
|
|
4165
3661
|
// Scene metadata
|
|
4166
|
-
if (
|
|
3662
|
+
if (this._babylonScene.metadata) {
|
|
4167
3663
|
if (this._options.metadataSelector) {
|
|
4168
|
-
scene.extras = this._options.metadataSelector(
|
|
3664
|
+
scene.extras = this._options.metadataSelector(this._babylonScene.metadata);
|
|
4169
3665
|
}
|
|
4170
|
-
else if (
|
|
4171
|
-
scene.extras =
|
|
3666
|
+
else if (this._babylonScene.metadata.gltf) {
|
|
3667
|
+
scene.extras = this._babylonScene.metadata.gltf.extras;
|
|
4172
3668
|
}
|
|
4173
3669
|
}
|
|
4174
|
-
//
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
babylonScene.rootNodes.forEach(function (rootNode) {
|
|
4183
|
-
if (_this._includeCoordinateSystemConversionNodes) {
|
|
4184
|
-
return;
|
|
4185
|
-
}
|
|
4186
|
-
if (_this._isBabylonCoordinateSystemConvertingNode(rootNode)) {
|
|
4187
|
-
rootNodesToLeftHanded.push(rootNode);
|
|
4188
|
-
// Exclude the node from list of nodes to export
|
|
4189
|
-
var indexRootNode = nodes.indexOf(rootNode);
|
|
4190
|
-
if (indexRootNode !== -1) {
|
|
4191
|
-
// should always be true
|
|
4192
|
-
nodes.splice(indexRootNode, 1);
|
|
3670
|
+
// Remove no-op root nodes
|
|
3671
|
+
if (((_a = this._options.removeNoopRootNodes) !== null && _a !== void 0 ? _a : true) && !this._options.includeCoordinateSystemConversionNodes) {
|
|
3672
|
+
for (var _i = 0, _b = this._babylonScene.rootNodes; _i < _b.length; _i++) {
|
|
3673
|
+
var rootNode = _b[_i];
|
|
3674
|
+
if (isNoopNode(rootNode, this._babylonScene.useRightHandedSystem)) {
|
|
3675
|
+
removedRootNodes.add(rootNode);
|
|
3676
|
+
// Exclude the node from list of nodes to export
|
|
3677
|
+
nodes.splice(nodes.indexOf(rootNode), 1);
|
|
4193
3678
|
}
|
|
4194
|
-
// Cancel conversion to right handed system
|
|
4195
|
-
rootNode.getDescendants(false).forEach(function (descendant) {
|
|
4196
|
-
_this._convertToRightHandedSystemMap[descendant.uniqueId] = false;
|
|
4197
|
-
});
|
|
4198
3679
|
}
|
|
4199
|
-
}
|
|
3680
|
+
}
|
|
4200
3681
|
// Export babylon cameras to glTFCamera
|
|
4201
3682
|
var cameraMap = new Map();
|
|
4202
|
-
|
|
3683
|
+
this._babylonScene.cameras.forEach(function (camera) {
|
|
4203
3684
|
if (!_this._options.shouldExportNode || _this._options.shouldExportNode(camera)) {
|
|
4204
3685
|
var glTFCamera = {
|
|
4205
|
-
type: camera.mode ===
|
|
3686
|
+
type: camera.mode === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Camera.PERSPECTIVE_CAMERA ? "perspective" /* CameraType.PERSPECTIVE */ : "orthographic" /* CameraType.ORTHOGRAPHIC */,
|
|
4206
3687
|
};
|
|
4207
3688
|
if (camera.name) {
|
|
4208
3689
|
glTFCamera.name = camera.name;
|
|
@@ -4210,7 +3691,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4210
3691
|
if (glTFCamera.type === "perspective" /* CameraType.PERSPECTIVE */) {
|
|
4211
3692
|
glTFCamera.perspective = {
|
|
4212
3693
|
aspectRatio: camera.getEngine().getAspectRatio(camera),
|
|
4213
|
-
yfov: camera.fovMode ===
|
|
3694
|
+
yfov: camera.fovMode === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Camera.FOVMODE_VERTICAL_FIXED ? camera.fov : camera.fov * camera.getEngine().getAspectRatio(camera),
|
|
4214
3695
|
znear: camera.minZ,
|
|
4215
3696
|
zfar: camera.maxZ,
|
|
4216
3697
|
};
|
|
@@ -4229,10 +3710,10 @@ var _Exporter = /** @class */ (function () {
|
|
|
4229
3710
|
_this._cameras.push(glTFCamera);
|
|
4230
3711
|
}
|
|
4231
3712
|
});
|
|
4232
|
-
var
|
|
3713
|
+
var _c = this._getExportNodes(nodes), exportNodes = _c[0], exportMaterials = _c[1];
|
|
4233
3714
|
return this._glTFMaterialExporter._convertMaterialsToGLTFAsync(exportMaterials, "image/png" /* ImageMimeType.PNG */, true).then(function () {
|
|
4234
|
-
return _this._createNodeMapAndAnimationsAsync(
|
|
4235
|
-
return _this._createSkinsAsync(
|
|
3715
|
+
return _this._createNodeMapAndAnimationsAsync(exportNodes, binaryWriter).then(function (nodeMap) {
|
|
3716
|
+
return _this._createSkinsAsync(nodeMap, binaryWriter).then(function (skinMap) {
|
|
4236
3717
|
_this._nodeMap = nodeMap;
|
|
4237
3718
|
_this._totalByteLength = binaryWriter.getByteOffset();
|
|
4238
3719
|
if (_this._totalByteLength == undefined) {
|
|
@@ -4252,31 +3733,23 @@ var _Exporter = /** @class */ (function () {
|
|
|
4252
3733
|
glTFNode.extras = babylonNode.metadata.gltf.extras;
|
|
4253
3734
|
}
|
|
4254
3735
|
}
|
|
4255
|
-
if (babylonNode instanceof
|
|
3736
|
+
if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Camera) {
|
|
4256
3737
|
glTFNode.camera = cameraMap.get(babylonNode);
|
|
4257
3738
|
}
|
|
4258
|
-
if (
|
|
4259
|
-
|
|
4260
|
-
|
|
3739
|
+
if (_this._options.shouldExportNode && !_this._options.shouldExportNode(babylonNode)) {
|
|
3740
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Log("Omitting " + babylonNode.name + " from scene.");
|
|
3741
|
+
}
|
|
3742
|
+
else {
|
|
3743
|
+
if (!babylonNode.parent && !_this._babylonScene.useRightHandedSystem) {
|
|
3744
|
+
convertNodeHandedness(glTFNode);
|
|
4261
3745
|
}
|
|
4262
|
-
|
|
4263
|
-
var convertToRightHandedSystem = _this._convertToRightHandedSystemMap[babylonNode.uniqueId];
|
|
4264
|
-
if (convertToRightHandedSystem) {
|
|
4265
|
-
if (glTFNode.translation) {
|
|
4266
|
-
glTFNode.translation[2] *= -1;
|
|
4267
|
-
glTFNode.translation[0] *= -1;
|
|
4268
|
-
}
|
|
4269
|
-
glTFNode.rotation = glTFNode.rotation
|
|
4270
|
-
? core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray([0, 1, 0, 0]).multiply(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray(glTFNode.rotation)).asArray()
|
|
4271
|
-
: core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__.Quaternion.FromArray([0, 1, 0, 0]).asArray();
|
|
4272
|
-
}
|
|
3746
|
+
if (!babylonNode.parent || removedRootNodes.has(babylonNode.parent)) {
|
|
4273
3747
|
scene.nodes.push(glTFNodeIndex);
|
|
4274
3748
|
}
|
|
4275
3749
|
}
|
|
4276
|
-
if (babylonNode instanceof
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
glTFNode.skin = skinMap[babylonMesh.skeleton.uniqueId];
|
|
3750
|
+
if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
|
|
3751
|
+
if (babylonNode.skeleton) {
|
|
3752
|
+
glTFNode.skin = skinMap[babylonNode.skeleton.uniqueId];
|
|
4280
3753
|
}
|
|
4281
3754
|
}
|
|
4282
3755
|
directDescendents = babylonNode.getDescendants(true);
|
|
@@ -4317,7 +3790,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4317
3790
|
var babylonMesh = babylonNode;
|
|
4318
3791
|
if (babylonMesh.subMeshes && babylonMesh.subMeshes.length > 0) {
|
|
4319
3792
|
var material = babylonMesh.material || babylonMesh.getScene().defaultMaterial;
|
|
4320
|
-
if (material instanceof
|
|
3793
|
+
if (material instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.MultiMaterial) {
|
|
4321
3794
|
for (var _a = 0, _b = material.subMaterials; _a < _b.length; _a++) {
|
|
4322
3795
|
var subMaterial = _b[_a];
|
|
4323
3796
|
if (subMaterial) {
|
|
@@ -4338,12 +3811,11 @@ var _Exporter = /** @class */ (function () {
|
|
|
4338
3811
|
};
|
|
4339
3812
|
/**
|
|
4340
3813
|
* Creates a mapping of Node unique id to node index and handles animations
|
|
4341
|
-
* @param babylonScene Babylon Scene
|
|
4342
3814
|
* @param nodes Babylon transform nodes
|
|
4343
3815
|
* @param binaryWriter Buffer to write binary data to
|
|
4344
3816
|
* @returns Node mapping of unique id to index
|
|
4345
3817
|
*/
|
|
4346
|
-
_Exporter.prototype._createNodeMapAndAnimationsAsync = function (
|
|
3818
|
+
_Exporter.prototype._createNodeMapAndAnimationsAsync = function (nodes, binaryWriter) {
|
|
4347
3819
|
var _this = this;
|
|
4348
3820
|
var promiseChain = Promise.resolve();
|
|
4349
3821
|
var nodeMap = {};
|
|
@@ -4356,11 +3828,10 @@ var _Exporter = /** @class */ (function () {
|
|
|
4356
3828
|
var idleGLTFAnimations = [];
|
|
4357
3829
|
var _loop_1 = function (babylonNode) {
|
|
4358
3830
|
promiseChain = promiseChain.then(function () {
|
|
4359
|
-
|
|
4360
|
-
return _this._createNodeAsync(babylonNode, binaryWriter, convertToRightHandedSystem).then(function (node) {
|
|
3831
|
+
return _this._createNodeAsync(babylonNode, binaryWriter).then(function (node) {
|
|
4361
3832
|
var promise = _this._extensionsPostExportNodeAsync("createNodeAsync", node, babylonNode, nodeMap, binaryWriter);
|
|
4362
3833
|
if (promise == null) {
|
|
4363
|
-
|
|
3834
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Not exporting node ".concat(babylonNode.name));
|
|
4364
3835
|
return Promise.resolve();
|
|
4365
3836
|
}
|
|
4366
3837
|
else {
|
|
@@ -4371,10 +3842,10 @@ var _Exporter = /** @class */ (function () {
|
|
|
4371
3842
|
_this._nodes.push(node);
|
|
4372
3843
|
nodeIndex = _this._nodes.length - 1;
|
|
4373
3844
|
nodeMap[babylonNode.uniqueId] = nodeIndex;
|
|
4374
|
-
if (!
|
|
4375
|
-
|
|
3845
|
+
if (!_this._babylonScene.animationGroups.length) {
|
|
3846
|
+
_glTFAnimation__WEBPACK_IMPORTED_MODULE_4__._GLTFAnimation._CreateMorphTargetAnimationFromMorphTargetAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, _this._animationSampleRate, _this._options.shouldExportAnimation);
|
|
4376
3847
|
if (babylonNode.animations.length) {
|
|
4377
|
-
|
|
3848
|
+
_glTFAnimation__WEBPACK_IMPORTED_MODULE_4__._GLTFAnimation._CreateNodeAnimationFromNodeAnimations(babylonNode, runtimeGLTFAnimation, idleGLTFAnimations, nodeMap, _this._nodes, binaryWriter, _this._bufferViews, _this._accessors, _this._animationSampleRate, _this._options.shouldExportAnimation);
|
|
4378
3849
|
}
|
|
4379
3850
|
}
|
|
4380
3851
|
});
|
|
@@ -4395,8 +3866,8 @@ var _Exporter = /** @class */ (function () {
|
|
|
4395
3866
|
_this._animations.push(idleGLTFAnimation);
|
|
4396
3867
|
}
|
|
4397
3868
|
});
|
|
4398
|
-
if (
|
|
4399
|
-
|
|
3869
|
+
if (_this._babylonScene.animationGroups.length) {
|
|
3870
|
+
_glTFAnimation__WEBPACK_IMPORTED_MODULE_4__._GLTFAnimation._CreateNodeAndMorphAnimationFromAnimationGroups(_this._babylonScene, _this._animations, nodeMap, binaryWriter, _this._bufferViews, _this._accessors, _this._animationSampleRate, _this._options.shouldExportAnimation);
|
|
4400
3871
|
}
|
|
4401
3872
|
return nodeMap;
|
|
4402
3873
|
});
|
|
@@ -4405,10 +3876,9 @@ var _Exporter = /** @class */ (function () {
|
|
|
4405
3876
|
* Creates a glTF node from a Babylon mesh
|
|
4406
3877
|
* @param babylonNode Source Babylon mesh
|
|
4407
3878
|
* @param binaryWriter Buffer for storing geometry data
|
|
4408
|
-
* @param convertToRightHandedSystem Converts the values to right-handed
|
|
4409
3879
|
* @returns glTF node
|
|
4410
3880
|
*/
|
|
4411
|
-
_Exporter.prototype._createNodeAsync = function (babylonNode, binaryWriter
|
|
3881
|
+
_Exporter.prototype._createNodeAsync = function (babylonNode, binaryWriter) {
|
|
4412
3882
|
var _this = this;
|
|
4413
3883
|
return Promise.resolve().then(function () {
|
|
4414
3884
|
// create node to hold translation/rotation/scale and the mesh
|
|
@@ -4418,10 +3888,10 @@ var _Exporter = /** @class */ (function () {
|
|
|
4418
3888
|
if (babylonNode.name) {
|
|
4419
3889
|
node.name = babylonNode.name;
|
|
4420
3890
|
}
|
|
4421
|
-
if (babylonNode instanceof
|
|
3891
|
+
if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TransformNode) {
|
|
4422
3892
|
// Set transformation
|
|
4423
|
-
_this._setNodeTransformation(node, babylonNode
|
|
4424
|
-
if (babylonNode instanceof
|
|
3893
|
+
_this._setNodeTransformation(node, babylonNode);
|
|
3894
|
+
if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Mesh) {
|
|
4425
3895
|
var morphTargetManager = babylonNode.morphTargetManager;
|
|
4426
3896
|
if (morphTargetManager && morphTargetManager.numTargets > 0) {
|
|
4427
3897
|
mesh.weights = [];
|
|
@@ -4430,7 +3900,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4430
3900
|
}
|
|
4431
3901
|
}
|
|
4432
3902
|
}
|
|
4433
|
-
return _this._setPrimitiveAttributesAsync(mesh, babylonNode, binaryWriter
|
|
3903
|
+
return _this._setPrimitiveAttributesAsync(mesh, babylonNode, binaryWriter).then(function () {
|
|
4434
3904
|
if (mesh.primitives.length) {
|
|
4435
3905
|
_this._meshes.push(mesh);
|
|
4436
3906
|
node.mesh = _this._meshes.length - 1;
|
|
@@ -4438,8 +3908,8 @@ var _Exporter = /** @class */ (function () {
|
|
|
4438
3908
|
return node;
|
|
4439
3909
|
});
|
|
4440
3910
|
}
|
|
4441
|
-
else if (babylonNode instanceof
|
|
4442
|
-
_this._setCameraTransformation(node, babylonNode
|
|
3911
|
+
else if (babylonNode instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Camera) {
|
|
3912
|
+
_this._setCameraTransformation(node, babylonNode);
|
|
4443
3913
|
return node;
|
|
4444
3914
|
}
|
|
4445
3915
|
else {
|
|
@@ -4454,11 +3924,11 @@ var _Exporter = /** @class */ (function () {
|
|
|
4454
3924
|
* @param binaryWriter Buffer to write binary data to
|
|
4455
3925
|
* @returns Node mapping of unique id to index
|
|
4456
3926
|
*/
|
|
4457
|
-
_Exporter.prototype._createSkinsAsync = function (
|
|
3927
|
+
_Exporter.prototype._createSkinsAsync = function (nodeMap, binaryWriter) {
|
|
4458
3928
|
var _a;
|
|
4459
3929
|
var promiseChain = Promise.resolve();
|
|
4460
3930
|
var skinMap = {};
|
|
4461
|
-
for (var _i = 0, _b =
|
|
3931
|
+
for (var _i = 0, _b = this._babylonScene.skeletons; _i < _b.length; _i++) {
|
|
4462
3932
|
var skeleton = _b[_i];
|
|
4463
3933
|
if (skeleton.bones.length <= 0) {
|
|
4464
3934
|
continue;
|
|
@@ -4486,7 +3956,7 @@ var _Exporter = /** @class */ (function () {
|
|
|
4486
3956
|
skin.joints.push(nodeMap[transformNode.uniqueId]);
|
|
4487
3957
|
}
|
|
4488
3958
|
else {
|
|
4489
|
-
|
|
3959
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Exporting a bone without a linked transform node is currently unsupported");
|
|
4490
3960
|
}
|
|
4491
3961
|
}
|
|
4492
3962
|
if (skin.joints.length > 0) {
|
|
@@ -4494,10 +3964,10 @@ var _Exporter = /** @class */ (function () {
|
|
|
4494
3964
|
var byteStride = 64; // 4 x 4 matrix of 32 bit float
|
|
4495
3965
|
var byteLength = inverseBindMatrices.length * byteStride;
|
|
4496
3966
|
var bufferViewOffset = binaryWriter.getByteOffset();
|
|
4497
|
-
var bufferView =
|
|
3967
|
+
var bufferView = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateBufferView(0, bufferViewOffset, byteLength, undefined, "InverseBindMatrices" + " - " + skeleton.name);
|
|
4498
3968
|
this._bufferViews.push(bufferView);
|
|
4499
3969
|
var bufferViewIndex = this._bufferViews.length - 1;
|
|
4500
|
-
var bindMatrixAccessor =
|
|
3970
|
+
var bindMatrixAccessor = _glTFUtilities__WEBPACK_IMPORTED_MODULE_2__._GLTFUtilities._CreateAccessor(bufferViewIndex, "InverseBindMatrices" + " - " + skeleton.name, "MAT4" /* AccessorType.MAT4 */, 5126 /* AccessorComponentType.FLOAT */, inverseBindMatrices.length, null, null, null);
|
|
4501
3971
|
var inverseBindAccessorIndex = this._accessors.push(bindMatrixAccessor) - 1;
|
|
4502
3972
|
skin.inverseBindMatrices = inverseBindAccessorIndex;
|
|
4503
3973
|
this._skins.push(skin);
|
|
@@ -4575,7 +4045,7 @@ var _BinaryWriter = /** @class */ (function () {
|
|
|
4575
4045
|
this._dataView.setUint8(byteOffset, entry);
|
|
4576
4046
|
}
|
|
4577
4047
|
else {
|
|
4578
|
-
|
|
4048
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4579
4049
|
}
|
|
4580
4050
|
}
|
|
4581
4051
|
else {
|
|
@@ -4597,7 +4067,7 @@ var _BinaryWriter = /** @class */ (function () {
|
|
|
4597
4067
|
this._dataView.setUint16(byteOffset, entry, true);
|
|
4598
4068
|
}
|
|
4599
4069
|
else {
|
|
4600
|
-
|
|
4070
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4601
4071
|
}
|
|
4602
4072
|
}
|
|
4603
4073
|
else {
|
|
@@ -4617,13 +4087,13 @@ var _BinaryWriter = /** @class */ (function () {
|
|
|
4617
4087
|
return this._dataView.getUint32(byteOffset, true);
|
|
4618
4088
|
}
|
|
4619
4089
|
else {
|
|
4620
|
-
|
|
4090
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4621
4091
|
throw new Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4622
4092
|
}
|
|
4623
4093
|
};
|
|
4624
4094
|
_BinaryWriter.prototype.getVector3Float32FromRef = function (vector3, byteOffset) {
|
|
4625
4095
|
if (byteOffset + 8 > this._byteOffset) {
|
|
4626
|
-
|
|
4096
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4627
4097
|
}
|
|
4628
4098
|
else {
|
|
4629
4099
|
vector3.x = this._dataView.getFloat32(byteOffset, true);
|
|
@@ -4633,7 +4103,7 @@ var _BinaryWriter = /** @class */ (function () {
|
|
|
4633
4103
|
};
|
|
4634
4104
|
_BinaryWriter.prototype.setVector3Float32FromRef = function (vector3, byteOffset) {
|
|
4635
4105
|
if (byteOffset + 8 > this._byteOffset) {
|
|
4636
|
-
|
|
4106
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4637
4107
|
}
|
|
4638
4108
|
else {
|
|
4639
4109
|
this._dataView.setFloat32(byteOffset, vector3.x, true);
|
|
@@ -4643,7 +4113,7 @@ var _BinaryWriter = /** @class */ (function () {
|
|
|
4643
4113
|
};
|
|
4644
4114
|
_BinaryWriter.prototype.getVector4Float32FromRef = function (vector4, byteOffset) {
|
|
4645
4115
|
if (byteOffset + 12 > this._byteOffset) {
|
|
4646
|
-
|
|
4116
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4647
4117
|
}
|
|
4648
4118
|
else {
|
|
4649
4119
|
vector4.x = this._dataView.getFloat32(byteOffset, true);
|
|
@@ -4654,7 +4124,7 @@ var _BinaryWriter = /** @class */ (function () {
|
|
|
4654
4124
|
};
|
|
4655
4125
|
_BinaryWriter.prototype.setVector4Float32FromRef = function (vector4, byteOffset) {
|
|
4656
4126
|
if (byteOffset + 12 > this._byteOffset) {
|
|
4657
|
-
|
|
4127
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4658
4128
|
}
|
|
4659
4129
|
else {
|
|
4660
4130
|
this._dataView.setFloat32(byteOffset, vector4.x, true);
|
|
@@ -4670,14 +4140,14 @@ var _BinaryWriter = /** @class */ (function () {
|
|
|
4670
4140
|
*/
|
|
4671
4141
|
_BinaryWriter.prototype.setFloat32 = function (entry, byteOffset) {
|
|
4672
4142
|
if (isNaN(entry)) {
|
|
4673
|
-
|
|
4143
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("Invalid data being written!");
|
|
4674
4144
|
}
|
|
4675
4145
|
if (byteOffset != null) {
|
|
4676
4146
|
if (byteOffset < this._byteOffset) {
|
|
4677
4147
|
this._dataView.setFloat32(byteOffset, entry, true);
|
|
4678
4148
|
}
|
|
4679
4149
|
else {
|
|
4680
|
-
|
|
4150
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary length!");
|
|
4681
4151
|
}
|
|
4682
4152
|
}
|
|
4683
4153
|
if (this._byteOffset + 4 > this._arrayBuffer.byteLength) {
|
|
@@ -4697,7 +4167,7 @@ var _BinaryWriter = /** @class */ (function () {
|
|
|
4697
4167
|
this._dataView.setUint32(byteOffset, entry, true);
|
|
4698
4168
|
}
|
|
4699
4169
|
else {
|
|
4700
|
-
|
|
4170
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4701
4171
|
}
|
|
4702
4172
|
}
|
|
4703
4173
|
else {
|
|
@@ -4719,7 +4189,7 @@ var _BinaryWriter = /** @class */ (function () {
|
|
|
4719
4189
|
this._dataView.setInt16(byteOffset, entry, true);
|
|
4720
4190
|
}
|
|
4721
4191
|
else {
|
|
4722
|
-
|
|
4192
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4723
4193
|
}
|
|
4724
4194
|
}
|
|
4725
4195
|
else {
|
|
@@ -4741,7 +4211,7 @@ var _BinaryWriter = /** @class */ (function () {
|
|
|
4741
4211
|
this._dataView.setInt8(byteOffset, entry);
|
|
4742
4212
|
}
|
|
4743
4213
|
else {
|
|
4744
|
-
|
|
4214
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("BinaryWriter: byteoffset is greater than the current binary buffer length!");
|
|
4745
4215
|
}
|
|
4746
4216
|
}
|
|
4747
4217
|
else {
|
|
@@ -4767,7 +4237,7 @@ var _BinaryWriter = /** @class */ (function () {
|
|
|
4767
4237
|
|
|
4768
4238
|
__webpack_require__.r(__webpack_exports__);
|
|
4769
4239
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4770
|
-
/* harmony export */
|
|
4240
|
+
/* harmony export */ __IGLTFExporterExtensionV2: () => (/* binding */ __IGLTFExporterExtensionV2)
|
|
4771
4241
|
/* harmony export */ });
|
|
4772
4242
|
/** @internal */
|
|
4773
4243
|
// eslint-disable-next-line no-var, @typescript-eslint/naming-convention
|
|
@@ -4784,11 +4254,11 @@ var __IGLTFExporterExtensionV2 = 0; // I am here to allow dts to be created
|
|
|
4784
4254
|
|
|
4785
4255
|
__webpack_require__.r(__webpack_exports__);
|
|
4786
4256
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4787
|
-
/* harmony export */
|
|
4257
|
+
/* harmony export */ _GLTFMaterialExporter: () => (/* binding */ _GLTFMaterialExporter)
|
|
4788
4258
|
/* harmony export */ });
|
|
4789
|
-
/* harmony import */ var
|
|
4790
|
-
/* harmony import */ var
|
|
4791
|
-
/* harmony import */ var
|
|
4259
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
4260
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Misc/dumpTools */ "core/Maths/math.vector");
|
|
4261
|
+
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
4792
4262
|
|
|
4793
4263
|
|
|
4794
4264
|
|
|
@@ -4831,7 +4301,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
4831
4301
|
* @param epsilon threshold value
|
|
4832
4302
|
*/
|
|
4833
4303
|
_GLTFMaterialExporter._FuzzyEquals = function (color1, color2, epsilon) {
|
|
4834
|
-
return
|
|
4304
|
+
return core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Scalar.WithinEpsilon(color1.r, color2.r, epsilon) && core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Scalar.WithinEpsilon(color1.g, color2.g, epsilon) && core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Scalar.WithinEpsilon(color1.b, color2.b, epsilon);
|
|
4835
4305
|
};
|
|
4836
4306
|
/**
|
|
4837
4307
|
* Gets the materials from a Babylon scene and converts them to glTF materials
|
|
@@ -4850,7 +4320,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
4850
4320
|
promises.push(_this._convertPBRMaterialAsync(material, mimeType, hasTextureCoords));
|
|
4851
4321
|
}
|
|
4852
4322
|
else {
|
|
4853
|
-
|
|
4323
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported material type: ".concat(material.name));
|
|
4854
4324
|
}
|
|
4855
4325
|
});
|
|
4856
4326
|
return Promise.all(promises).then(function () {
|
|
@@ -4922,10 +4392,10 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
4922
4392
|
*/
|
|
4923
4393
|
_GLTFMaterialExporter.prototype._convertToGLTFPBRMetallicRoughness = function (babylonStandardMaterial) {
|
|
4924
4394
|
// Defines a cubic bezier curve where x is specular power and y is roughness
|
|
4925
|
-
var P0 = new
|
|
4926
|
-
var P1 = new
|
|
4927
|
-
var P2 = new
|
|
4928
|
-
var P3 = new
|
|
4395
|
+
var P0 = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 1);
|
|
4396
|
+
var P1 = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 0.1);
|
|
4397
|
+
var P2 = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 0.1);
|
|
4398
|
+
var P3 = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector2(1300, 0.1);
|
|
4929
4399
|
/**
|
|
4930
4400
|
* Given the control points, solve for x based on a given t for a cubic bezier curve
|
|
4931
4401
|
* @param t a value between 0 and 1
|
|
@@ -4954,7 +4424,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
4954
4424
|
}
|
|
4955
4425
|
var diffuse = babylonStandardMaterial.diffuseColor.toLinearSpace(babylonStandardMaterial.getScene().getEngine().useExactSrgbConversions).scale(0.5);
|
|
4956
4426
|
var opacity = babylonStandardMaterial.alpha;
|
|
4957
|
-
var specularPower =
|
|
4427
|
+
var specularPower = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Scalar.Clamp(babylonStandardMaterial.specularPower, 0, _GLTFMaterialExporter._MaxSpecularPower);
|
|
4958
4428
|
var roughness = solveForRoughness(specularPower);
|
|
4959
4429
|
var glTFPbrMetallicRoughness = {
|
|
4960
4430
|
baseColorFactor: [diffuse.r, diffuse.g, diffuse.b, opacity],
|
|
@@ -4979,7 +4449,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
4979
4449
|
var b = (diffuse * oneMinusSpecularStrength) / (1.0 - this._DielectricSpecular.r) + specular - 2.0 * this._DielectricSpecular.r;
|
|
4980
4450
|
var c = this._DielectricSpecular.r - specular;
|
|
4981
4451
|
var D = b * b - 4.0 * a * c;
|
|
4982
|
-
return
|
|
4452
|
+
return core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Scalar.Clamp((-b + Math.sqrt(D)) / (2.0 * a), 0, 1);
|
|
4983
4453
|
};
|
|
4984
4454
|
/**
|
|
4985
4455
|
* Sets the glTF alpha mode to a glTF material from the Babylon Material
|
|
@@ -5009,7 +4479,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5009
4479
|
var material = { name: babylonStandardMaterial.name };
|
|
5010
4480
|
if (babylonStandardMaterial.backFaceCulling != null && !babylonStandardMaterial.backFaceCulling) {
|
|
5011
4481
|
if (!babylonStandardMaterial.twoSidedLighting) {
|
|
5012
|
-
|
|
4482
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(babylonStandardMaterial.name + ": Back-face culling disabled and two-sided lighting disabled is not supported in glTF.");
|
|
5013
4483
|
}
|
|
5014
4484
|
material.doubleSided = true;
|
|
5015
4485
|
}
|
|
@@ -5052,14 +4522,14 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5052
4522
|
}
|
|
5053
4523
|
}
|
|
5054
4524
|
if (babylonStandardMaterial.alpha < 1.0 || babylonStandardMaterial.opacityTexture) {
|
|
5055
|
-
if (babylonStandardMaterial.alphaMode ===
|
|
4525
|
+
if (babylonStandardMaterial.alphaMode === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.ALPHA_COMBINE) {
|
|
5056
4526
|
material.alphaMode = "BLEND" /* MaterialAlphaMode.BLEND */;
|
|
5057
4527
|
}
|
|
5058
4528
|
else {
|
|
5059
|
-
|
|
4529
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(babylonStandardMaterial.name + ": glTF 2.0 does not support alpha mode: " + babylonStandardMaterial.alphaMode.toString());
|
|
5060
4530
|
}
|
|
5061
4531
|
}
|
|
5062
|
-
if (babylonStandardMaterial.emissiveColor && !_GLTFMaterialExporter._FuzzyEquals(babylonStandardMaterial.emissiveColor,
|
|
4532
|
+
if (babylonStandardMaterial.emissiveColor && !_GLTFMaterialExporter._FuzzyEquals(babylonStandardMaterial.emissiveColor, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.Black(), _GLTFMaterialExporter._Epsilon)) {
|
|
5063
4533
|
material.emissiveFactor = babylonStandardMaterial.emissiveColor.asArray();
|
|
5064
4534
|
}
|
|
5065
4535
|
material.pbrMetallicRoughness = pbrMetallicRoughness;
|
|
@@ -5101,22 +4571,22 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5101
4571
|
* @returns base64 image string
|
|
5102
4572
|
*/
|
|
5103
4573
|
_GLTFMaterialExporter.prototype._getImageDataAsync = function (buffer, width, height, mimeType) {
|
|
5104
|
-
return (0,
|
|
4574
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__awaiter)(this, void 0, void 0, function () {
|
|
5105
4575
|
var textureType, hostingScene, engine, tempTexture, data;
|
|
5106
|
-
return (0,
|
|
4576
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__generator)(this, function (_a) {
|
|
5107
4577
|
switch (_a.label) {
|
|
5108
4578
|
case 0:
|
|
5109
|
-
textureType =
|
|
4579
|
+
textureType = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTURETYPE_UNSIGNED_INT;
|
|
5110
4580
|
hostingScene = this._exporter._babylonScene;
|
|
5111
4581
|
engine = hostingScene.getEngine();
|
|
5112
|
-
tempTexture = engine.createRawTexture(buffer, width, height,
|
|
5113
|
-
return [4 /*yield*/,
|
|
4582
|
+
tempTexture = engine.createRawTexture(buffer, width, height, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTUREFORMAT_RGBA, false, true, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_SAMPLINGMODE, null, textureType);
|
|
4583
|
+
return [4 /*yield*/, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TextureTools.ApplyPostProcess("pass", tempTexture, hostingScene, textureType, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTURE_NEAREST_SAMPLINGMODE, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTUREFORMAT_RGBA)];
|
|
5114
4584
|
case 1:
|
|
5115
4585
|
_a.sent();
|
|
5116
4586
|
return [4 /*yield*/, engine._readTexturePixels(tempTexture, width, height)];
|
|
5117
4587
|
case 2:
|
|
5118
4588
|
data = _a.sent();
|
|
5119
|
-
return [4 /*yield*/,
|
|
4589
|
+
return [4 /*yield*/, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.DumpTools.DumpDataAsync(width, height, data, mimeType, undefined, true, true)];
|
|
5120
4590
|
case 3: return [2 /*return*/, (_a.sent())];
|
|
5121
4591
|
}
|
|
5122
4592
|
});
|
|
@@ -5134,7 +4604,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5134
4604
|
for (var i = 0; i < data.length; i = i + 4) {
|
|
5135
4605
|
data[i] = data[i + 1] = data[i + 2] = data[i + 3] = 0xff;
|
|
5136
4606
|
}
|
|
5137
|
-
var rawTexture =
|
|
4607
|
+
var rawTexture = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.RawTexture.CreateRGBATexture(data, width, height, scene);
|
|
5138
4608
|
return rawTexture;
|
|
5139
4609
|
};
|
|
5140
4610
|
/**
|
|
@@ -5150,8 +4620,8 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5150
4620
|
var resizedTexture1;
|
|
5151
4621
|
var resizedTexture2;
|
|
5152
4622
|
if (texture1Size.width < texture2Size.width) {
|
|
5153
|
-
if (texture1 && texture1 instanceof
|
|
5154
|
-
resizedTexture1 =
|
|
4623
|
+
if (texture1 && texture1 instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture) {
|
|
4624
|
+
resizedTexture1 = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TextureTools.CreateResizedCopy(texture1, texture2Size.width, texture2Size.height, true);
|
|
5155
4625
|
}
|
|
5156
4626
|
else {
|
|
5157
4627
|
resizedTexture1 = this._createWhiteTexture(texture2Size.width, texture2Size.height, scene);
|
|
@@ -5159,8 +4629,8 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5159
4629
|
resizedTexture2 = texture2;
|
|
5160
4630
|
}
|
|
5161
4631
|
else if (texture1Size.width > texture2Size.width) {
|
|
5162
|
-
if (texture2 && texture2 instanceof
|
|
5163
|
-
resizedTexture2 =
|
|
4632
|
+
if (texture2 && texture2 instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture) {
|
|
4633
|
+
resizedTexture2 = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.TextureTools.CreateResizedCopy(texture2, texture1Size.width, texture1Size.height, true);
|
|
5164
4634
|
}
|
|
5165
4635
|
else {
|
|
5166
4636
|
resizedTexture2 = this._createWhiteTexture(texture1Size.width, texture1Size.height, scene);
|
|
@@ -5210,9 +4680,9 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5210
4680
|
*/
|
|
5211
4681
|
_GLTFMaterialExporter.prototype._convertSpecularGlossinessTexturesToMetallicRoughnessAsync = function (diffuseTexture, specularGlossinessTexture, factors, mimeType) {
|
|
5212
4682
|
var _a;
|
|
5213
|
-
return (0,
|
|
4683
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__awaiter)(this, void 0, void 0, function () {
|
|
5214
4684
|
var promises, scene, resizedTextures, diffuseSize, diffuseBuffer, specularGlossinessBuffer, width, height, diffusePixels, specularPixels, byteLength, metallicRoughnessBuffer, baseColorBuffer, strideSize, maxBaseColor, maxMetallic, maxRoughness, h, w, offset, diffuseColor, specularColor, glossiness, specularGlossiness, metallicRoughness, metallicRoughnessFactors_1, writeOutMetallicRoughnessTexture, writeOutBaseColorTexture, h, w, destinationOffset, linearBaseColorPixel, sRGBBaseColorPixel, metallicRoughnessPixel;
|
|
5215
|
-
return (0,
|
|
4685
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__generator)(this, function (_b) {
|
|
5216
4686
|
switch (_b.label) {
|
|
5217
4687
|
case 0:
|
|
5218
4688
|
promises = new Array();
|
|
@@ -5249,16 +4719,16 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5249
4719
|
metallicRoughnessBuffer = new Uint8Array(byteLength);
|
|
5250
4720
|
baseColorBuffer = new Uint8Array(byteLength);
|
|
5251
4721
|
strideSize = 4;
|
|
5252
|
-
maxBaseColor =
|
|
4722
|
+
maxBaseColor = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.Black();
|
|
5253
4723
|
maxMetallic = 0;
|
|
5254
4724
|
maxRoughness = 0;
|
|
5255
4725
|
for (h = 0; h < height; ++h) {
|
|
5256
4726
|
for (w = 0; w < width; ++w) {
|
|
5257
4727
|
offset = (width * h + w) * strideSize;
|
|
5258
|
-
diffuseColor = new
|
|
4728
|
+
diffuseColor = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3(diffuseBuffer[offset], diffuseBuffer[offset + 1], diffuseBuffer[offset + 2])
|
|
5259
4729
|
.toLinearSpace(scene.getEngine().useExactSrgbConversions)
|
|
5260
4730
|
.multiply(factors.diffuseColor);
|
|
5261
|
-
specularColor = new
|
|
4731
|
+
specularColor = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3(specularGlossinessBuffer[offset], specularGlossinessBuffer[offset + 1], specularGlossinessBuffer[offset + 2])
|
|
5262
4732
|
.toLinearSpace(scene.getEngine().useExactSrgbConversions)
|
|
5263
4733
|
.multiply(factors.specularColor);
|
|
5264
4734
|
glossiness = specularGlossinessBuffer[offset + 3] * factors.glossiness;
|
|
@@ -5296,19 +4766,19 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5296
4766
|
baseColorBuffer[destinationOffset] /= metallicRoughnessFactors_1.baseColor.r > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors_1.baseColor.r : 1;
|
|
5297
4767
|
baseColorBuffer[destinationOffset + 1] /= metallicRoughnessFactors_1.baseColor.g > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors_1.baseColor.g : 1;
|
|
5298
4768
|
baseColorBuffer[destinationOffset + 2] /= metallicRoughnessFactors_1.baseColor.b > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors_1.baseColor.b : 1;
|
|
5299
|
-
linearBaseColorPixel =
|
|
4769
|
+
linearBaseColorPixel = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.FromInts(baseColorBuffer[destinationOffset], baseColorBuffer[destinationOffset + 1], baseColorBuffer[destinationOffset + 2]);
|
|
5300
4770
|
sRGBBaseColorPixel = linearBaseColorPixel.toGammaSpace(scene.getEngine().useExactSrgbConversions);
|
|
5301
4771
|
baseColorBuffer[destinationOffset] = sRGBBaseColorPixel.r * 255;
|
|
5302
4772
|
baseColorBuffer[destinationOffset + 1] = sRGBBaseColorPixel.g * 255;
|
|
5303
4773
|
baseColorBuffer[destinationOffset + 2] = sRGBBaseColorPixel.b * 255;
|
|
5304
|
-
if (!_GLTFMaterialExporter._FuzzyEquals(sRGBBaseColorPixel,
|
|
4774
|
+
if (!_GLTFMaterialExporter._FuzzyEquals(sRGBBaseColorPixel, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White(), _GLTFMaterialExporter._Epsilon)) {
|
|
5305
4775
|
writeOutBaseColorTexture = true;
|
|
5306
4776
|
}
|
|
5307
4777
|
metallicRoughnessBuffer[destinationOffset + 1] /=
|
|
5308
4778
|
metallicRoughnessFactors_1.roughness > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors_1.roughness : 1;
|
|
5309
4779
|
metallicRoughnessBuffer[destinationOffset + 2] /= metallicRoughnessFactors_1.metallic > _GLTFMaterialExporter._Epsilon ? metallicRoughnessFactors_1.metallic : 1;
|
|
5310
|
-
metallicRoughnessPixel =
|
|
5311
|
-
if (!_GLTFMaterialExporter._FuzzyEquals(metallicRoughnessPixel,
|
|
4780
|
+
metallicRoughnessPixel = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.FromInts(255, metallicRoughnessBuffer[destinationOffset + 1], metallicRoughnessBuffer[destinationOffset + 2]);
|
|
4781
|
+
if (!_GLTFMaterialExporter._FuzzyEquals(metallicRoughnessPixel, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White(), _GLTFMaterialExporter._Epsilon)) {
|
|
5312
4782
|
writeOutMetallicRoughnessTexture = true;
|
|
5313
4783
|
}
|
|
5314
4784
|
}
|
|
@@ -5345,7 +4815,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5345
4815
|
var baseColorFromSpecular = specularGlossiness.specularColor
|
|
5346
4816
|
.subtract(_GLTFMaterialExporter._DielectricSpecular.scale(1 - metallic))
|
|
5347
4817
|
.scale(1 / Math.max(metallic, _GLTFMaterialExporter._Epsilon));
|
|
5348
|
-
var baseColor =
|
|
4818
|
+
var baseColor = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.Lerp(baseColorFromDiffuse, baseColorFromSpecular, metallic * metallic);
|
|
5349
4819
|
baseColor = baseColor.clampToRef(0, 1, baseColor);
|
|
5350
4820
|
var metallicRoughness = {
|
|
5351
4821
|
baseColor: baseColor,
|
|
@@ -5418,7 +4888,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5418
4888
|
};
|
|
5419
4889
|
_GLTFMaterialExporter.prototype._getTextureSampler = function (texture) {
|
|
5420
4890
|
var sampler = {};
|
|
5421
|
-
if (!texture || !(texture instanceof
|
|
4891
|
+
if (!texture || !(texture instanceof core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture)) {
|
|
5422
4892
|
return sampler;
|
|
5423
4893
|
}
|
|
5424
4894
|
var wrapS = this._getGLTFTextureWrapMode(texture.wrapU);
|
|
@@ -5430,62 +4900,62 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5430
4900
|
sampler.wrapT = wrapT;
|
|
5431
4901
|
}
|
|
5432
4902
|
switch (texture.samplingMode) {
|
|
5433
|
-
case
|
|
4903
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_LINEAR: {
|
|
5434
4904
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
5435
4905
|
sampler.minFilter = 9729 /* TextureMinFilter.LINEAR */;
|
|
5436
4906
|
break;
|
|
5437
4907
|
}
|
|
5438
|
-
case
|
|
4908
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_NEAREST: {
|
|
5439
4909
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
5440
4910
|
sampler.minFilter = 9728 /* TextureMinFilter.NEAREST */;
|
|
5441
4911
|
break;
|
|
5442
4912
|
}
|
|
5443
|
-
case
|
|
4913
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_LINEAR: {
|
|
5444
4914
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
5445
4915
|
sampler.minFilter = 9729 /* TextureMinFilter.LINEAR */;
|
|
5446
4916
|
break;
|
|
5447
4917
|
}
|
|
5448
|
-
case
|
|
4918
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_LINEAR_MIPLINEAR: {
|
|
5449
4919
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
5450
4920
|
sampler.minFilter = 9987 /* TextureMinFilter.LINEAR_MIPMAP_LINEAR */;
|
|
5451
4921
|
break;
|
|
5452
4922
|
}
|
|
5453
|
-
case
|
|
4923
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_NEAREST: {
|
|
5454
4924
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
5455
4925
|
sampler.minFilter = 9728 /* TextureMinFilter.NEAREST */;
|
|
5456
4926
|
break;
|
|
5457
4927
|
}
|
|
5458
|
-
case
|
|
4928
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_LINEAR_MIPNEAREST: {
|
|
5459
4929
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
5460
4930
|
sampler.minFilter = 9985 /* TextureMinFilter.LINEAR_MIPMAP_NEAREST */;
|
|
5461
4931
|
break;
|
|
5462
4932
|
}
|
|
5463
|
-
case
|
|
4933
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_NEAREST_MIPNEAREST: {
|
|
5464
4934
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
5465
4935
|
sampler.minFilter = 9984 /* TextureMinFilter.NEAREST_MIPMAP_NEAREST */;
|
|
5466
4936
|
break;
|
|
5467
4937
|
}
|
|
5468
|
-
case
|
|
4938
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_NEAREST_MIPLINEAR: {
|
|
5469
4939
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
5470
4940
|
sampler.minFilter = 9986 /* TextureMinFilter.NEAREST_MIPMAP_LINEAR */;
|
|
5471
4941
|
break;
|
|
5472
4942
|
}
|
|
5473
|
-
case
|
|
4943
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_NEAREST_MIPLINEAR: {
|
|
5474
4944
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
5475
4945
|
sampler.minFilter = 9986 /* TextureMinFilter.NEAREST_MIPMAP_LINEAR */;
|
|
5476
4946
|
break;
|
|
5477
4947
|
}
|
|
5478
|
-
case
|
|
4948
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_LINEAR_MIPLINEAR: {
|
|
5479
4949
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
5480
4950
|
sampler.minFilter = 9987 /* TextureMinFilter.LINEAR_MIPMAP_LINEAR */;
|
|
5481
4951
|
break;
|
|
5482
4952
|
}
|
|
5483
|
-
case
|
|
4953
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.LINEAR_LINEAR_MIPNEAREST: {
|
|
5484
4954
|
sampler.magFilter = 9729 /* TextureMagFilter.LINEAR */;
|
|
5485
4955
|
sampler.minFilter = 9985 /* TextureMinFilter.LINEAR_MIPMAP_NEAREST */;
|
|
5486
4956
|
break;
|
|
5487
4957
|
}
|
|
5488
|
-
case
|
|
4958
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.NEAREST_NEAREST_MIPNEAREST: {
|
|
5489
4959
|
sampler.magFilter = 9728 /* TextureMagFilter.NEAREST */;
|
|
5490
4960
|
sampler.minFilter = 9984 /* TextureMinFilter.NEAREST_MIPMAP_NEAREST */;
|
|
5491
4961
|
break;
|
|
@@ -5495,17 +4965,17 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5495
4965
|
};
|
|
5496
4966
|
_GLTFMaterialExporter.prototype._getGLTFTextureWrapMode = function (wrapMode) {
|
|
5497
4967
|
switch (wrapMode) {
|
|
5498
|
-
case
|
|
4968
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.WRAP_ADDRESSMODE: {
|
|
5499
4969
|
return 10497 /* TextureWrapMode.REPEAT */;
|
|
5500
4970
|
}
|
|
5501
|
-
case
|
|
4971
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.CLAMP_ADDRESSMODE: {
|
|
5502
4972
|
return 33071 /* TextureWrapMode.CLAMP_TO_EDGE */;
|
|
5503
4973
|
}
|
|
5504
|
-
case
|
|
4974
|
+
case core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Texture.MIRROR_ADDRESSMODE: {
|
|
5505
4975
|
return 33648 /* TextureWrapMode.MIRRORED_REPEAT */;
|
|
5506
4976
|
}
|
|
5507
4977
|
default: {
|
|
5508
|
-
|
|
4978
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Error("Unsupported Texture Wrap Mode ".concat(wrapMode, "!"));
|
|
5509
4979
|
return 10497 /* TextureWrapMode.REPEAT */;
|
|
5510
4980
|
}
|
|
5511
4981
|
}
|
|
@@ -5587,7 +5057,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5587
5057
|
var promises = [];
|
|
5588
5058
|
if (metallicRoughness) {
|
|
5589
5059
|
_GLTFMaterialExporter._SetAlphaMode(glTFMaterial, babylonPBRMaterial);
|
|
5590
|
-
if (!(_GLTFMaterialExporter._FuzzyEquals(metallicRoughness.baseColor,
|
|
5060
|
+
if (!(_GLTFMaterialExporter._FuzzyEquals(metallicRoughness.baseColor, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.White(), _GLTFMaterialExporter._Epsilon) &&
|
|
5591
5061
|
babylonPBRMaterial.alpha >= _GLTFMaterialExporter._Epsilon)) {
|
|
5592
5062
|
glTFPbrMetallicRoughness.baseColorFactor = [metallicRoughness.baseColor.r, metallicRoughness.baseColor.g, metallicRoughness.baseColor.b, babylonPBRMaterial.alpha];
|
|
5593
5063
|
}
|
|
@@ -5599,7 +5069,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5599
5069
|
}
|
|
5600
5070
|
if (babylonPBRMaterial.backFaceCulling != null && !babylonPBRMaterial.backFaceCulling) {
|
|
5601
5071
|
if (!babylonPBRMaterial._twoSidedLighting) {
|
|
5602
|
-
|
|
5072
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn(babylonPBRMaterial.name + ": Back-face culling disabled and two-sided lighting disabled is not supported in glTF.");
|
|
5603
5073
|
}
|
|
5604
5074
|
glTFMaterial.doubleSided = true;
|
|
5605
5075
|
}
|
|
@@ -5645,7 +5115,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5645
5115
|
}
|
|
5646
5116
|
}
|
|
5647
5117
|
var emissiveColor = babylonPBRMaterial._emissiveColor;
|
|
5648
|
-
if (!_GLTFMaterialExporter._FuzzyEquals(emissiveColor,
|
|
5118
|
+
if (!_GLTFMaterialExporter._FuzzyEquals(emissiveColor, core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3.Black(), _GLTFMaterialExporter._Epsilon)) {
|
|
5649
5119
|
glTFMaterial.emissiveFactor = emissiveColor.asArray();
|
|
5650
5120
|
}
|
|
5651
5121
|
glTFMaterial.pbrMetallicRoughness = glTFPbrMetallicRoughness;
|
|
@@ -5655,7 +5125,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5655
5125
|
return this._finishMaterial(promises, glTFMaterial, babylonPBRMaterial, mimeType);
|
|
5656
5126
|
};
|
|
5657
5127
|
_GLTFMaterialExporter.prototype._getPixelsFromTexture = function (babylonTexture) {
|
|
5658
|
-
var pixels = babylonTexture.textureType ===
|
|
5128
|
+
var pixels = babylonTexture.textureType === core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTURETYPE_UNSIGNED_INT
|
|
5659
5129
|
? babylonTexture.readPixels()
|
|
5660
5130
|
: babylonTexture.readPixels();
|
|
5661
5131
|
return pixels;
|
|
@@ -5680,10 +5150,10 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5680
5150
|
});
|
|
5681
5151
|
};
|
|
5682
5152
|
_GLTFMaterialExporter.prototype._exportTextureInfoAsync = function (babylonTexture, mimeType) {
|
|
5683
|
-
return (0,
|
|
5153
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__awaiter)(this, void 0, void 0, function () {
|
|
5684
5154
|
var textureUid, pixels_1, samplerIndex, textureMimeType, internalTextureToImage, internalTextureUniqueId, imageIndexPromise, size_1, textureInfo, _a;
|
|
5685
5155
|
var _this = this;
|
|
5686
|
-
return (0,
|
|
5156
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__generator)(this, function (_b) {
|
|
5687
5157
|
switch (_b.label) {
|
|
5688
5158
|
case 0:
|
|
5689
5159
|
textureUid = babylonTexture.uid;
|
|
@@ -5704,7 +5174,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5704
5174
|
mimeType = textureMimeType;
|
|
5705
5175
|
break;
|
|
5706
5176
|
default:
|
|
5707
|
-
|
|
5177
|
+
core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.Warn("Unsupported media type: ".concat(textureMimeType));
|
|
5708
5178
|
break;
|
|
5709
5179
|
}
|
|
5710
5180
|
}
|
|
@@ -5714,9 +5184,9 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5714
5184
|
imageIndexPromise = internalTextureToImage[internalTextureUniqueId][mimeType];
|
|
5715
5185
|
if (imageIndexPromise === undefined) {
|
|
5716
5186
|
size_1 = babylonTexture.getSize();
|
|
5717
|
-
imageIndexPromise = (function () { return (0,
|
|
5187
|
+
imageIndexPromise = (function () { return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__awaiter)(_this, void 0, void 0, function () {
|
|
5718
5188
|
var data;
|
|
5719
|
-
return (0,
|
|
5189
|
+
return (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__generator)(this, function (_a) {
|
|
5720
5190
|
switch (_a.label) {
|
|
5721
5191
|
case 0: return [4 /*yield*/, this._getImageDataAsync(pixels_1, size_1.width, size_1.height, mimeType)];
|
|
5722
5192
|
case 1:
|
|
@@ -5745,7 +5215,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5745
5215
|
var extension = getFileExtensionFromMimeType(mimeType);
|
|
5746
5216
|
var fileName = baseName + extension;
|
|
5747
5217
|
if (fileName in imageData) {
|
|
5748
|
-
fileName = "".concat(baseName, "_").concat(
|
|
5218
|
+
fileName = "".concat(baseName, "_").concat(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Tools.RandomId()).concat(extension);
|
|
5749
5219
|
}
|
|
5750
5220
|
imageData[fileName] = {
|
|
5751
5221
|
data: data,
|
|
@@ -5788,7 +5258,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5788
5258
|
/**
|
|
5789
5259
|
* Represents the dielectric specular values for R, G and B
|
|
5790
5260
|
*/
|
|
5791
|
-
_GLTFMaterialExporter._DielectricSpecular = new
|
|
5261
|
+
_GLTFMaterialExporter._DielectricSpecular = new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Color3(0.04, 0.04, 0.04);
|
|
5792
5262
|
/**
|
|
5793
5263
|
* Allows the maximum specular power to be defined for material calculations
|
|
5794
5264
|
*/
|
|
@@ -5812,7 +5282,7 @@ var _GLTFMaterialExporter = /** @class */ (function () {
|
|
|
5812
5282
|
|
|
5813
5283
|
__webpack_require__.r(__webpack_exports__);
|
|
5814
5284
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5815
|
-
/* harmony export */
|
|
5285
|
+
/* harmony export */ GLTF2Export: () => (/* binding */ GLTF2Export)
|
|
5816
5286
|
/* harmony export */ });
|
|
5817
5287
|
/* harmony import */ var _glTFExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFExporter */ "../../../lts/serializers/dist/glTF/2.0/glTFExporter.js");
|
|
5818
5288
|
|
|
@@ -5889,7 +5359,7 @@ var GLTF2Export = /** @class */ (function () {
|
|
|
5889
5359
|
|
|
5890
5360
|
__webpack_require__.r(__webpack_exports__);
|
|
5891
5361
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5892
|
-
/* harmony export */
|
|
5362
|
+
/* harmony export */ _GLTFUtilities: () => (/* binding */ _GLTFUtilities)
|
|
5893
5363
|
/* harmony export */ });
|
|
5894
5364
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Maths/math.vector */ "core/Maths/math.vector");
|
|
5895
5365
|
/* harmony import */ var core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -5952,10 +5422,9 @@ var _GLTFUtilities = /** @class */ (function () {
|
|
|
5952
5422
|
* @param positions Positions array of a mesh
|
|
5953
5423
|
* @param vertexStart Starting vertex offset to calculate min and max values
|
|
5954
5424
|
* @param vertexCount Number of vertices to check for min and max values
|
|
5955
|
-
* @param convertToRightHandedSystem
|
|
5956
5425
|
* @returns min number array and max number array
|
|
5957
5426
|
*/
|
|
5958
|
-
_GLTFUtilities._CalculateMinMaxPositions = function (positions, vertexStart, vertexCount
|
|
5427
|
+
_GLTFUtilities._CalculateMinMaxPositions = function (positions, vertexStart, vertexCount) {
|
|
5959
5428
|
var min = [Infinity, Infinity, Infinity];
|
|
5960
5429
|
var max = [-Infinity, -Infinity, -Infinity];
|
|
5961
5430
|
var positionStrideSize = 3;
|
|
@@ -5966,9 +5435,6 @@ var _GLTFUtilities = /** @class */ (function () {
|
|
|
5966
5435
|
for (var i = vertexStart, length_1 = vertexStart + vertexCount; i < length_1; ++i) {
|
|
5967
5436
|
indexOffset = positionStrideSize * i;
|
|
5968
5437
|
position = core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3.FromArray(positions, indexOffset);
|
|
5969
|
-
if (convertToRightHandedSystem) {
|
|
5970
|
-
_GLTFUtilities._GetRightHandedPositionVector3FromRef(position);
|
|
5971
|
-
}
|
|
5972
5438
|
vector = position.asArray();
|
|
5973
5439
|
for (var j = 0; j < positionStrideSize; ++j) {
|
|
5974
5440
|
var num = vector[j];
|
|
@@ -5984,82 +5450,6 @@ var _GLTFUtilities = /** @class */ (function () {
|
|
|
5984
5450
|
}
|
|
5985
5451
|
return { min: min, max: max };
|
|
5986
5452
|
};
|
|
5987
|
-
/**
|
|
5988
|
-
* Converts a new right-handed Vector3
|
|
5989
|
-
* @param vector vector3 array
|
|
5990
|
-
* @returns right-handed Vector3
|
|
5991
|
-
*/
|
|
5992
|
-
_GLTFUtilities._GetRightHandedPositionVector3 = function (vector) {
|
|
5993
|
-
return new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(vector.x, vector.y, -vector.z);
|
|
5994
|
-
};
|
|
5995
|
-
/**
|
|
5996
|
-
* Converts a Vector3 to right-handed
|
|
5997
|
-
* @param vector Vector3 to convert to right-handed
|
|
5998
|
-
*/
|
|
5999
|
-
_GLTFUtilities._GetRightHandedPositionVector3FromRef = function (vector) {
|
|
6000
|
-
vector.z *= -1;
|
|
6001
|
-
};
|
|
6002
|
-
/**
|
|
6003
|
-
* Converts a three element number array to right-handed
|
|
6004
|
-
* @param vector number array to convert to right-handed
|
|
6005
|
-
*/
|
|
6006
|
-
_GLTFUtilities._GetRightHandedPositionArray3FromRef = function (vector) {
|
|
6007
|
-
vector[2] *= -1;
|
|
6008
|
-
};
|
|
6009
|
-
/**
|
|
6010
|
-
* Converts a new right-handed Vector3
|
|
6011
|
-
* @param vector vector3 array
|
|
6012
|
-
* @returns right-handed Vector3
|
|
6013
|
-
*/
|
|
6014
|
-
_GLTFUtilities._GetRightHandedNormalVector3 = function (vector) {
|
|
6015
|
-
return new core_Maths_math_vector__WEBPACK_IMPORTED_MODULE_0__.Vector3(vector.x, vector.y, -vector.z);
|
|
6016
|
-
};
|
|
6017
|
-
/**
|
|
6018
|
-
* Converts a Vector3 to right-handed
|
|
6019
|
-
* @param vector Vector3 to convert to right-handed
|
|
6020
|
-
*/
|
|
6021
|
-
_GLTFUtilities._GetRightHandedNormalVector3FromRef = function (vector) {
|
|
6022
|
-
vector.z *= -1;
|
|
6023
|
-
};
|
|
6024
|
-
/**
|
|
6025
|
-
* Converts a three element number array to right-handed
|
|
6026
|
-
* @param vector number array to convert to right-handed
|
|
6027
|
-
*/
|
|
6028
|
-
_GLTFUtilities._GetRightHandedNormalArray3FromRef = function (vector) {
|
|
6029
|
-
vector[2] *= -1;
|
|
6030
|
-
};
|
|
6031
|
-
/**
|
|
6032
|
-
* Converts a Vector4 to right-handed
|
|
6033
|
-
* @param vector Vector4 to convert to right-handed
|
|
6034
|
-
*/
|
|
6035
|
-
_GLTFUtilities._GetRightHandedVector4FromRef = function (vector) {
|
|
6036
|
-
vector.z *= -1;
|
|
6037
|
-
vector.w *= -1;
|
|
6038
|
-
};
|
|
6039
|
-
/**
|
|
6040
|
-
* Converts a Vector4 to right-handed
|
|
6041
|
-
* @param vector Vector4 to convert to right-handed
|
|
6042
|
-
*/
|
|
6043
|
-
_GLTFUtilities._GetRightHandedArray4FromRef = function (vector) {
|
|
6044
|
-
vector[2] *= -1;
|
|
6045
|
-
vector[3] *= -1;
|
|
6046
|
-
};
|
|
6047
|
-
/**
|
|
6048
|
-
* Converts a Quaternion to right-handed
|
|
6049
|
-
* @param quaternion Source quaternion to convert to right-handed
|
|
6050
|
-
*/
|
|
6051
|
-
_GLTFUtilities._GetRightHandedQuaternionFromRef = function (quaternion) {
|
|
6052
|
-
quaternion.x *= -1;
|
|
6053
|
-
quaternion.y *= -1;
|
|
6054
|
-
};
|
|
6055
|
-
/**
|
|
6056
|
-
* Converts a Quaternion to right-handed
|
|
6057
|
-
* @param quaternion Source quaternion to convert to right-handed
|
|
6058
|
-
*/
|
|
6059
|
-
_GLTFUtilities._GetRightHandedQuaternionArrayFromRef = function (quaternion) {
|
|
6060
|
-
quaternion[0] *= -1;
|
|
6061
|
-
quaternion[1] *= -1;
|
|
6062
|
-
};
|
|
6063
5453
|
_GLTFUtilities._NormalizeTangentFromRef = function (tangent) {
|
|
6064
5454
|
var length = Math.sqrt(tangent.x * tangent.x + tangent.y * tangent.y + tangent.z * tangent.z);
|
|
6065
5455
|
if (length > 0) {
|
|
@@ -6101,27 +5491,27 @@ var _GLTFUtilities = /** @class */ (function () {
|
|
|
6101
5491
|
|
|
6102
5492
|
__webpack_require__.r(__webpack_exports__);
|
|
6103
5493
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6104
|
-
/* harmony export */
|
|
6105
|
-
/* harmony export */
|
|
6106
|
-
/* harmony export */
|
|
6107
|
-
/* harmony export */
|
|
6108
|
-
/* harmony export */
|
|
6109
|
-
/* harmony export */
|
|
6110
|
-
/* harmony export */
|
|
6111
|
-
/* harmony export */
|
|
6112
|
-
/* harmony export */
|
|
6113
|
-
/* harmony export */
|
|
6114
|
-
/* harmony export */
|
|
6115
|
-
/* harmony export */
|
|
6116
|
-
/* harmony export */
|
|
6117
|
-
/* harmony export */
|
|
6118
|
-
/* harmony export */
|
|
6119
|
-
/* harmony export */
|
|
6120
|
-
/* harmony export */
|
|
6121
|
-
/* harmony export */
|
|
6122
|
-
/* harmony export */
|
|
6123
|
-
/* harmony export */
|
|
6124
|
-
/* harmony export */
|
|
5494
|
+
/* harmony export */ EXT_mesh_gpu_instancing: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.EXT_mesh_gpu_instancing),
|
|
5495
|
+
/* harmony export */ GLTF2Export: () => (/* reexport safe */ _glTFSerializer__WEBPACK_IMPORTED_MODULE_5__.GLTF2Export),
|
|
5496
|
+
/* harmony export */ GLTFData: () => (/* reexport safe */ _glTFData__WEBPACK_IMPORTED_MODULE_1__.GLTFData),
|
|
5497
|
+
/* harmony export */ KHR_lights_punctual: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_lights_punctual),
|
|
5498
|
+
/* harmony export */ KHR_materials_anisotropy: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_materials_anisotropy),
|
|
5499
|
+
/* harmony export */ KHR_materials_clearcoat: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_materials_clearcoat),
|
|
5500
|
+
/* harmony export */ KHR_materials_emissive_strength: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_materials_emissive_strength),
|
|
5501
|
+
/* harmony export */ KHR_materials_ior: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_materials_ior),
|
|
5502
|
+
/* harmony export */ KHR_materials_iridescence: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_materials_iridescence),
|
|
5503
|
+
/* harmony export */ KHR_materials_sheen: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_materials_sheen),
|
|
5504
|
+
/* harmony export */ KHR_materials_specular: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_materials_specular),
|
|
5505
|
+
/* harmony export */ KHR_materials_transmission: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_materials_transmission),
|
|
5506
|
+
/* harmony export */ KHR_materials_unlit: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_materials_unlit),
|
|
5507
|
+
/* harmony export */ KHR_materials_volume: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_materials_volume),
|
|
5508
|
+
/* harmony export */ KHR_texture_transform: () => (/* reexport safe */ _Extensions_index__WEBPACK_IMPORTED_MODULE_7__.KHR_texture_transform),
|
|
5509
|
+
/* harmony export */ _BinaryWriter: () => (/* reexport safe */ _glTFExporter__WEBPACK_IMPORTED_MODULE_2__._BinaryWriter),
|
|
5510
|
+
/* harmony export */ _Exporter: () => (/* reexport safe */ _glTFExporter__WEBPACK_IMPORTED_MODULE_2__._Exporter),
|
|
5511
|
+
/* harmony export */ _GLTFAnimation: () => (/* reexport safe */ _glTFAnimation__WEBPACK_IMPORTED_MODULE_0__._GLTFAnimation),
|
|
5512
|
+
/* harmony export */ _GLTFMaterialExporter: () => (/* reexport safe */ _glTFMaterialExporter__WEBPACK_IMPORTED_MODULE_4__._GLTFMaterialExporter),
|
|
5513
|
+
/* harmony export */ _GLTFUtilities: () => (/* reexport safe */ _glTFUtilities__WEBPACK_IMPORTED_MODULE_6__._GLTFUtilities),
|
|
5514
|
+
/* harmony export */ __IGLTFExporterExtensionV2: () => (/* reexport safe */ _glTFExporterExtension__WEBPACK_IMPORTED_MODULE_3__.__IGLTFExporterExtensionV2)
|
|
6125
5515
|
/* harmony export */ });
|
|
6126
5516
|
/* harmony import */ var _glTFAnimation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./glTFAnimation */ "../../../lts/serializers/dist/glTF/2.0/glTFAnimation.js");
|
|
6127
5517
|
/* harmony import */ var _glTFData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./glTFData */ "../../../lts/serializers/dist/glTF/2.0/glTFData.js");
|
|
@@ -6152,7 +5542,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6152
5542
|
|
|
6153
5543
|
__webpack_require__.r(__webpack_exports__);
|
|
6154
5544
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6155
|
-
/* harmony export */
|
|
5545
|
+
/* harmony export */ __IGLTFExporterExtension: () => (/* binding */ __IGLTFExporterExtension)
|
|
6156
5546
|
/* harmony export */ });
|
|
6157
5547
|
/** @internal */
|
|
6158
5548
|
// eslint-disable-next-line no-var, @typescript-eslint/naming-convention
|
|
@@ -6169,28 +5559,28 @@ var __IGLTFExporterExtension = 0; // I am here to allow dts to be created
|
|
|
6169
5559
|
|
|
6170
5560
|
__webpack_require__.r(__webpack_exports__);
|
|
6171
5561
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6172
|
-
/* harmony export */
|
|
6173
|
-
/* harmony export */
|
|
6174
|
-
/* harmony export */
|
|
6175
|
-
/* harmony export */
|
|
6176
|
-
/* harmony export */
|
|
6177
|
-
/* harmony export */
|
|
6178
|
-
/* harmony export */
|
|
6179
|
-
/* harmony export */
|
|
6180
|
-
/* harmony export */
|
|
6181
|
-
/* harmony export */
|
|
6182
|
-
/* harmony export */
|
|
6183
|
-
/* harmony export */
|
|
6184
|
-
/* harmony export */
|
|
6185
|
-
/* harmony export */
|
|
6186
|
-
/* harmony export */
|
|
6187
|
-
/* harmony export */
|
|
6188
|
-
/* harmony export */
|
|
6189
|
-
/* harmony export */
|
|
6190
|
-
/* harmony export */
|
|
6191
|
-
/* harmony export */
|
|
6192
|
-
/* harmony export */
|
|
6193
|
-
/* harmony export */
|
|
5562
|
+
/* harmony export */ EXT_mesh_gpu_instancing: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.EXT_mesh_gpu_instancing),
|
|
5563
|
+
/* harmony export */ GLTF2Export: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.GLTF2Export),
|
|
5564
|
+
/* harmony export */ GLTFData: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.GLTFData),
|
|
5565
|
+
/* harmony export */ KHR_lights_punctual: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_lights_punctual),
|
|
5566
|
+
/* harmony export */ KHR_materials_anisotropy: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_materials_anisotropy),
|
|
5567
|
+
/* harmony export */ KHR_materials_clearcoat: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_materials_clearcoat),
|
|
5568
|
+
/* harmony export */ KHR_materials_emissive_strength: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_materials_emissive_strength),
|
|
5569
|
+
/* harmony export */ KHR_materials_ior: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_materials_ior),
|
|
5570
|
+
/* harmony export */ KHR_materials_iridescence: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_materials_iridescence),
|
|
5571
|
+
/* harmony export */ KHR_materials_sheen: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_materials_sheen),
|
|
5572
|
+
/* harmony export */ KHR_materials_specular: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_materials_specular),
|
|
5573
|
+
/* harmony export */ KHR_materials_transmission: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_materials_transmission),
|
|
5574
|
+
/* harmony export */ KHR_materials_unlit: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_materials_unlit),
|
|
5575
|
+
/* harmony export */ KHR_materials_volume: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_materials_volume),
|
|
5576
|
+
/* harmony export */ KHR_texture_transform: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.KHR_texture_transform),
|
|
5577
|
+
/* harmony export */ _BinaryWriter: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__._BinaryWriter),
|
|
5578
|
+
/* harmony export */ _Exporter: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__._Exporter),
|
|
5579
|
+
/* harmony export */ _GLTFAnimation: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__._GLTFAnimation),
|
|
5580
|
+
/* harmony export */ _GLTFMaterialExporter: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__._GLTFMaterialExporter),
|
|
5581
|
+
/* harmony export */ _GLTFUtilities: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__._GLTFUtilities),
|
|
5582
|
+
/* harmony export */ __IGLTFExporterExtension: () => (/* reexport safe */ _glTF_glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__.__IGLTFExporterExtension),
|
|
5583
|
+
/* harmony export */ __IGLTFExporterExtensionV2: () => (/* reexport safe */ _glTF_2_0_index__WEBPACK_IMPORTED_MODULE_4__.__IGLTFExporterExtensionV2)
|
|
6194
5584
|
/* harmony export */ });
|
|
6195
5585
|
/* harmony import */ var _glTF_glTFFileExporter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../glTF/glTFFileExporter */ "../../../lts/serializers/dist/glTF/glTFFileExporter.js");
|
|
6196
5586
|
/* harmony import */ var _glTF_2_0_glTFData__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../glTF/2.0/glTFData */ "../../../lts/serializers/dist/glTF/2.0/glTFData.js");
|
|
@@ -6253,6 +5643,370 @@ if (typeof globalObject !== "undefined") {
|
|
|
6253
5643
|
|
|
6254
5644
|
module.exports = __WEBPACK_EXTERNAL_MODULE_core_Maths_math_vector__;
|
|
6255
5645
|
|
|
5646
|
+
/***/ }),
|
|
5647
|
+
|
|
5648
|
+
/***/ "../../../../node_modules/tslib/tslib.es6.mjs":
|
|
5649
|
+
/*!****************************************************!*\
|
|
5650
|
+
!*** ../../../../node_modules/tslib/tslib.es6.mjs ***!
|
|
5651
|
+
\****************************************************/
|
|
5652
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
5653
|
+
|
|
5654
|
+
__webpack_require__.r(__webpack_exports__);
|
|
5655
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
5656
|
+
/* harmony export */ __assign: () => (/* binding */ __assign),
|
|
5657
|
+
/* harmony export */ __asyncDelegator: () => (/* binding */ __asyncDelegator),
|
|
5658
|
+
/* harmony export */ __asyncGenerator: () => (/* binding */ __asyncGenerator),
|
|
5659
|
+
/* harmony export */ __asyncValues: () => (/* binding */ __asyncValues),
|
|
5660
|
+
/* harmony export */ __await: () => (/* binding */ __await),
|
|
5661
|
+
/* harmony export */ __awaiter: () => (/* binding */ __awaiter),
|
|
5662
|
+
/* harmony export */ __classPrivateFieldGet: () => (/* binding */ __classPrivateFieldGet),
|
|
5663
|
+
/* harmony export */ __classPrivateFieldIn: () => (/* binding */ __classPrivateFieldIn),
|
|
5664
|
+
/* harmony export */ __classPrivateFieldSet: () => (/* binding */ __classPrivateFieldSet),
|
|
5665
|
+
/* harmony export */ __createBinding: () => (/* binding */ __createBinding),
|
|
5666
|
+
/* harmony export */ __decorate: () => (/* binding */ __decorate),
|
|
5667
|
+
/* harmony export */ __esDecorate: () => (/* binding */ __esDecorate),
|
|
5668
|
+
/* harmony export */ __exportStar: () => (/* binding */ __exportStar),
|
|
5669
|
+
/* harmony export */ __extends: () => (/* binding */ __extends),
|
|
5670
|
+
/* harmony export */ __generator: () => (/* binding */ __generator),
|
|
5671
|
+
/* harmony export */ __importDefault: () => (/* binding */ __importDefault),
|
|
5672
|
+
/* harmony export */ __importStar: () => (/* binding */ __importStar),
|
|
5673
|
+
/* harmony export */ __makeTemplateObject: () => (/* binding */ __makeTemplateObject),
|
|
5674
|
+
/* harmony export */ __metadata: () => (/* binding */ __metadata),
|
|
5675
|
+
/* harmony export */ __param: () => (/* binding */ __param),
|
|
5676
|
+
/* harmony export */ __propKey: () => (/* binding */ __propKey),
|
|
5677
|
+
/* harmony export */ __read: () => (/* binding */ __read),
|
|
5678
|
+
/* harmony export */ __rest: () => (/* binding */ __rest),
|
|
5679
|
+
/* harmony export */ __runInitializers: () => (/* binding */ __runInitializers),
|
|
5680
|
+
/* harmony export */ __setFunctionName: () => (/* binding */ __setFunctionName),
|
|
5681
|
+
/* harmony export */ __spread: () => (/* binding */ __spread),
|
|
5682
|
+
/* harmony export */ __spreadArray: () => (/* binding */ __spreadArray),
|
|
5683
|
+
/* harmony export */ __spreadArrays: () => (/* binding */ __spreadArrays),
|
|
5684
|
+
/* harmony export */ __values: () => (/* binding */ __values),
|
|
5685
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
5686
|
+
/* harmony export */ });
|
|
5687
|
+
/******************************************************************************
|
|
5688
|
+
Copyright (c) Microsoft Corporation.
|
|
5689
|
+
|
|
5690
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5691
|
+
purpose with or without fee is hereby granted.
|
|
5692
|
+
|
|
5693
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
5694
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
5695
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
5696
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
5697
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
5698
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
5699
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
5700
|
+
***************************************************************************** */
|
|
5701
|
+
/* global Reflect, Promise */
|
|
5702
|
+
|
|
5703
|
+
var extendStatics = function(d, b) {
|
|
5704
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5705
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5706
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
5707
|
+
return extendStatics(d, b);
|
|
5708
|
+
};
|
|
5709
|
+
|
|
5710
|
+
function __extends(d, b) {
|
|
5711
|
+
if (typeof b !== "function" && b !== null)
|
|
5712
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
5713
|
+
extendStatics(d, b);
|
|
5714
|
+
function __() { this.constructor = d; }
|
|
5715
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
5716
|
+
}
|
|
5717
|
+
|
|
5718
|
+
var __assign = function() {
|
|
5719
|
+
__assign = Object.assign || function __assign(t) {
|
|
5720
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5721
|
+
s = arguments[i];
|
|
5722
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
5723
|
+
}
|
|
5724
|
+
return t;
|
|
5725
|
+
}
|
|
5726
|
+
return __assign.apply(this, arguments);
|
|
5727
|
+
}
|
|
5728
|
+
|
|
5729
|
+
function __rest(s, e) {
|
|
5730
|
+
var t = {};
|
|
5731
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5732
|
+
t[p] = s[p];
|
|
5733
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
5734
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5735
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
5736
|
+
t[p[i]] = s[p[i]];
|
|
5737
|
+
}
|
|
5738
|
+
return t;
|
|
5739
|
+
}
|
|
5740
|
+
|
|
5741
|
+
function __decorate(decorators, target, key, desc) {
|
|
5742
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5743
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5744
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5745
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5746
|
+
}
|
|
5747
|
+
|
|
5748
|
+
function __param(paramIndex, decorator) {
|
|
5749
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
5750
|
+
}
|
|
5751
|
+
|
|
5752
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
5753
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
5754
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5755
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5756
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
5757
|
+
var _, done = false;
|
|
5758
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
5759
|
+
var context = {};
|
|
5760
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
5761
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
5762
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
5763
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
5764
|
+
if (kind === "accessor") {
|
|
5765
|
+
if (result === void 0) continue;
|
|
5766
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
5767
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
5768
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
5769
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
5770
|
+
}
|
|
5771
|
+
else if (_ = accept(result)) {
|
|
5772
|
+
if (kind === "field") initializers.unshift(_);
|
|
5773
|
+
else descriptor[key] = _;
|
|
5774
|
+
}
|
|
5775
|
+
}
|
|
5776
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
5777
|
+
done = true;
|
|
5778
|
+
};
|
|
5779
|
+
|
|
5780
|
+
function __runInitializers(thisArg, initializers, value) {
|
|
5781
|
+
var useValue = arguments.length > 2;
|
|
5782
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
5783
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
5784
|
+
}
|
|
5785
|
+
return useValue ? value : void 0;
|
|
5786
|
+
};
|
|
5787
|
+
|
|
5788
|
+
function __propKey(x) {
|
|
5789
|
+
return typeof x === "symbol" ? x : "".concat(x);
|
|
5790
|
+
};
|
|
5791
|
+
|
|
5792
|
+
function __setFunctionName(f, name, prefix) {
|
|
5793
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
5794
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
5795
|
+
};
|
|
5796
|
+
|
|
5797
|
+
function __metadata(metadataKey, metadataValue) {
|
|
5798
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
5799
|
+
}
|
|
5800
|
+
|
|
5801
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
5802
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5803
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5804
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5805
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
5806
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
5807
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5808
|
+
});
|
|
5809
|
+
}
|
|
5810
|
+
|
|
5811
|
+
function __generator(thisArg, body) {
|
|
5812
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
5813
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
5814
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
5815
|
+
function step(op) {
|
|
5816
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
5817
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
5818
|
+
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;
|
|
5819
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
5820
|
+
switch (op[0]) {
|
|
5821
|
+
case 0: case 1: t = op; break;
|
|
5822
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
5823
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
5824
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
5825
|
+
default:
|
|
5826
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
5827
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
5828
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
5829
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
5830
|
+
if (t[2]) _.ops.pop();
|
|
5831
|
+
_.trys.pop(); continue;
|
|
5832
|
+
}
|
|
5833
|
+
op = body.call(thisArg, _);
|
|
5834
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
5835
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
5836
|
+
}
|
|
5837
|
+
}
|
|
5838
|
+
|
|
5839
|
+
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
5840
|
+
if (k2 === undefined) k2 = k;
|
|
5841
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5842
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5843
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
5844
|
+
}
|
|
5845
|
+
Object.defineProperty(o, k2, desc);
|
|
5846
|
+
}) : (function(o, m, k, k2) {
|
|
5847
|
+
if (k2 === undefined) k2 = k;
|
|
5848
|
+
o[k2] = m[k];
|
|
5849
|
+
});
|
|
5850
|
+
|
|
5851
|
+
function __exportStar(m, o) {
|
|
5852
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
5853
|
+
}
|
|
5854
|
+
|
|
5855
|
+
function __values(o) {
|
|
5856
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
5857
|
+
if (m) return m.call(o);
|
|
5858
|
+
if (o && typeof o.length === "number") return {
|
|
5859
|
+
next: function () {
|
|
5860
|
+
if (o && i >= o.length) o = void 0;
|
|
5861
|
+
return { value: o && o[i++], done: !o };
|
|
5862
|
+
}
|
|
5863
|
+
};
|
|
5864
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
5865
|
+
}
|
|
5866
|
+
|
|
5867
|
+
function __read(o, n) {
|
|
5868
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
5869
|
+
if (!m) return o;
|
|
5870
|
+
var i = m.call(o), r, ar = [], e;
|
|
5871
|
+
try {
|
|
5872
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
5873
|
+
}
|
|
5874
|
+
catch (error) { e = { error: error }; }
|
|
5875
|
+
finally {
|
|
5876
|
+
try {
|
|
5877
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
5878
|
+
}
|
|
5879
|
+
finally { if (e) throw e.error; }
|
|
5880
|
+
}
|
|
5881
|
+
return ar;
|
|
5882
|
+
}
|
|
5883
|
+
|
|
5884
|
+
/** @deprecated */
|
|
5885
|
+
function __spread() {
|
|
5886
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
5887
|
+
ar = ar.concat(__read(arguments[i]));
|
|
5888
|
+
return ar;
|
|
5889
|
+
}
|
|
5890
|
+
|
|
5891
|
+
/** @deprecated */
|
|
5892
|
+
function __spreadArrays() {
|
|
5893
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
5894
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
5895
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
5896
|
+
r[k] = a[j];
|
|
5897
|
+
return r;
|
|
5898
|
+
}
|
|
5899
|
+
|
|
5900
|
+
function __spreadArray(to, from, pack) {
|
|
5901
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
5902
|
+
if (ar || !(i in from)) {
|
|
5903
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5904
|
+
ar[i] = from[i];
|
|
5905
|
+
}
|
|
5906
|
+
}
|
|
5907
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
5908
|
+
}
|
|
5909
|
+
|
|
5910
|
+
function __await(v) {
|
|
5911
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
5912
|
+
}
|
|
5913
|
+
|
|
5914
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
5915
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
5916
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
5917
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
5918
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
5919
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
5920
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
5921
|
+
function fulfill(value) { resume("next", value); }
|
|
5922
|
+
function reject(value) { resume("throw", value); }
|
|
5923
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
5924
|
+
}
|
|
5925
|
+
|
|
5926
|
+
function __asyncDelegator(o) {
|
|
5927
|
+
var i, p;
|
|
5928
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
5929
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
5930
|
+
}
|
|
5931
|
+
|
|
5932
|
+
function __asyncValues(o) {
|
|
5933
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
5934
|
+
var m = o[Symbol.asyncIterator], i;
|
|
5935
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
5936
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
5937
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
5938
|
+
}
|
|
5939
|
+
|
|
5940
|
+
function __makeTemplateObject(cooked, raw) {
|
|
5941
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
5942
|
+
return cooked;
|
|
5943
|
+
};
|
|
5944
|
+
|
|
5945
|
+
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
5946
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
5947
|
+
}) : function(o, v) {
|
|
5948
|
+
o["default"] = v;
|
|
5949
|
+
};
|
|
5950
|
+
|
|
5951
|
+
function __importStar(mod) {
|
|
5952
|
+
if (mod && mod.__esModule) return mod;
|
|
5953
|
+
var result = {};
|
|
5954
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
5955
|
+
__setModuleDefault(result, mod);
|
|
5956
|
+
return result;
|
|
5957
|
+
}
|
|
5958
|
+
|
|
5959
|
+
function __importDefault(mod) {
|
|
5960
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
5961
|
+
}
|
|
5962
|
+
|
|
5963
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
5964
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
5965
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5966
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5967
|
+
}
|
|
5968
|
+
|
|
5969
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
5970
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
5971
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5972
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5973
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
5974
|
+
}
|
|
5975
|
+
|
|
5976
|
+
function __classPrivateFieldIn(state, receiver) {
|
|
5977
|
+
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
|
5978
|
+
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
5979
|
+
}
|
|
5980
|
+
|
|
5981
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
5982
|
+
__extends,
|
|
5983
|
+
__assign,
|
|
5984
|
+
__rest,
|
|
5985
|
+
__decorate,
|
|
5986
|
+
__param,
|
|
5987
|
+
__metadata,
|
|
5988
|
+
__awaiter,
|
|
5989
|
+
__generator,
|
|
5990
|
+
__createBinding,
|
|
5991
|
+
__exportStar,
|
|
5992
|
+
__values,
|
|
5993
|
+
__read,
|
|
5994
|
+
__spread,
|
|
5995
|
+
__spreadArrays,
|
|
5996
|
+
__spreadArray,
|
|
5997
|
+
__await,
|
|
5998
|
+
__asyncGenerator,
|
|
5999
|
+
__asyncDelegator,
|
|
6000
|
+
__asyncValues,
|
|
6001
|
+
__makeTemplateObject,
|
|
6002
|
+
__importStar,
|
|
6003
|
+
__importDefault,
|
|
6004
|
+
__classPrivateFieldGet,
|
|
6005
|
+
__classPrivateFieldSet,
|
|
6006
|
+
__classPrivateFieldIn,
|
|
6007
|
+
});
|
|
6008
|
+
|
|
6009
|
+
|
|
6256
6010
|
/***/ })
|
|
6257
6011
|
|
|
6258
6012
|
/******/ });
|
|
@@ -6344,7 +6098,7 @@ var __webpack_exports__ = {};
|
|
|
6344
6098
|
__webpack_require__.r(__webpack_exports__);
|
|
6345
6099
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6346
6100
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
6347
|
-
/* harmony export */
|
|
6101
|
+
/* harmony export */ serializers: () => (/* reexport module object */ serializers_legacy_legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_0__)
|
|
6348
6102
|
/* harmony export */ });
|
|
6349
6103
|
/* harmony import */ var serializers_legacy_legacy_glTF2Serializer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! serializers/legacy/legacy-glTF2Serializer */ "../../../lts/serializers/dist/legacy/legacy-glTF2Serializer.js");
|
|
6350
6104
|
|