@vitessce/glb 3.5.12 → 3.6.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/dist/index.js +561 -889
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -51,257 +51,260 @@ class AbstractTwoStepLoader extends AbstractLoader {
|
|
|
51
51
|
this.dataSource = dataSource;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
var
|
|
55
|
-
var loglevel =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var noop = function() {
|
|
65
|
-
};
|
|
66
|
-
var undefinedType = "undefined";
|
|
67
|
-
var isIE = typeof window !== undefinedType && typeof window.navigator !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
|
|
68
|
-
var logMethods = [
|
|
69
|
-
"trace",
|
|
70
|
-
"debug",
|
|
71
|
-
"info",
|
|
72
|
-
"warn",
|
|
73
|
-
"error"
|
|
74
|
-
];
|
|
75
|
-
var _loggersByName = {};
|
|
76
|
-
var defaultLogger = null;
|
|
77
|
-
function bindMethod(obj, methodName) {
|
|
78
|
-
var method = obj[methodName];
|
|
79
|
-
if (typeof method.bind === "function") {
|
|
80
|
-
return method.bind(obj);
|
|
54
|
+
var loglevel$1 = { exports: {} };
|
|
55
|
+
var loglevel = loglevel$1.exports;
|
|
56
|
+
var hasRequiredLoglevel;
|
|
57
|
+
function requireLoglevel() {
|
|
58
|
+
if (hasRequiredLoglevel) return loglevel$1.exports;
|
|
59
|
+
hasRequiredLoglevel = 1;
|
|
60
|
+
(function(module) {
|
|
61
|
+
(function(root, definition) {
|
|
62
|
+
if (module.exports) {
|
|
63
|
+
module.exports = definition();
|
|
81
64
|
} else {
|
|
82
|
-
|
|
83
|
-
return Function.prototype.bind.call(method, obj);
|
|
84
|
-
} catch (e) {
|
|
85
|
-
return function() {
|
|
86
|
-
return Function.prototype.apply.apply(method, [obj, arguments]);
|
|
87
|
-
};
|
|
88
|
-
}
|
|
65
|
+
root.log = definition();
|
|
89
66
|
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
67
|
+
})(loglevel, function() {
|
|
68
|
+
var noop = function() {
|
|
69
|
+
};
|
|
70
|
+
var undefinedType = "undefined";
|
|
71
|
+
var isIE = typeof window !== undefinedType && typeof window.navigator !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
|
|
72
|
+
var logMethods = [
|
|
73
|
+
"trace",
|
|
74
|
+
"debug",
|
|
75
|
+
"info",
|
|
76
|
+
"warn",
|
|
77
|
+
"error"
|
|
78
|
+
];
|
|
79
|
+
var _loggersByName = {};
|
|
80
|
+
var defaultLogger = null;
|
|
81
|
+
function bindMethod(obj, methodName) {
|
|
82
|
+
var method = obj[methodName];
|
|
83
|
+
if (typeof method.bind === "function") {
|
|
84
|
+
return method.bind(obj);
|
|
95
85
|
} else {
|
|
96
|
-
|
|
86
|
+
try {
|
|
87
|
+
return Function.prototype.bind.call(method, obj);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
return function() {
|
|
90
|
+
return Function.prototype.apply.apply(method, [obj, arguments]);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
97
93
|
}
|
|
98
94
|
}
|
|
99
|
-
|
|
100
|
-
console.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
} else if (methodName === "trace" && isIE) {
|
|
109
|
-
return traceForIE;
|
|
110
|
-
} else if (console[methodName] !== void 0) {
|
|
111
|
-
return bindMethod(console, methodName);
|
|
112
|
-
} else if (console.log !== void 0) {
|
|
113
|
-
return bindMethod(console, "log");
|
|
114
|
-
} else {
|
|
115
|
-
return noop;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
function replaceLoggingMethods() {
|
|
119
|
-
var level = this.getLevel();
|
|
120
|
-
for (var i = 0; i < logMethods.length; i++) {
|
|
121
|
-
var methodName = logMethods[i];
|
|
122
|
-
this[methodName] = i < level ? noop : this.methodFactory(methodName, level, this.name);
|
|
123
|
-
}
|
|
124
|
-
this.log = this.debug;
|
|
125
|
-
if (typeof console === undefinedType && level < this.levels.SILENT) {
|
|
126
|
-
return "No console available for logging";
|
|
95
|
+
function traceForIE() {
|
|
96
|
+
if (console.log) {
|
|
97
|
+
if (console.log.apply) {
|
|
98
|
+
console.log.apply(console, arguments);
|
|
99
|
+
} else {
|
|
100
|
+
Function.prototype.apply.apply(console.log, [console, arguments]);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (console.trace) console.trace();
|
|
127
104
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (typeof console !== undefinedType) {
|
|
132
|
-
replaceLoggingMethods.call(this);
|
|
133
|
-
this[methodName].apply(this, arguments);
|
|
105
|
+
function realMethod(methodName) {
|
|
106
|
+
if (methodName === "debug") {
|
|
107
|
+
methodName = "log";
|
|
134
108
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var storageKey = "loglevel";
|
|
146
|
-
if (typeof name === "string") {
|
|
147
|
-
storageKey += ":" + name;
|
|
148
|
-
} else if (typeof name === "symbol") {
|
|
149
|
-
storageKey = void 0;
|
|
150
|
-
}
|
|
151
|
-
function persistLevelIfPossible(levelNum) {
|
|
152
|
-
var levelName = (logMethods[levelNum] || "silent").toUpperCase();
|
|
153
|
-
if (typeof window === undefinedType || !storageKey)
|
|
154
|
-
return;
|
|
155
|
-
try {
|
|
156
|
-
window.localStorage[storageKey] = levelName;
|
|
157
|
-
return;
|
|
158
|
-
} catch (ignore) {
|
|
109
|
+
if (typeof console === undefinedType) {
|
|
110
|
+
return false;
|
|
111
|
+
} else if (methodName === "trace" && isIE) {
|
|
112
|
+
return traceForIE;
|
|
113
|
+
} else if (console[methodName] !== void 0) {
|
|
114
|
+
return bindMethod(console, methodName);
|
|
115
|
+
} else if (console.log !== void 0) {
|
|
116
|
+
return bindMethod(console, "log");
|
|
117
|
+
} else {
|
|
118
|
+
return noop;
|
|
159
119
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
120
|
+
}
|
|
121
|
+
function replaceLoggingMethods() {
|
|
122
|
+
var level = this.getLevel();
|
|
123
|
+
for (var i = 0; i < logMethods.length; i++) {
|
|
124
|
+
var methodName = logMethods[i];
|
|
125
|
+
this[methodName] = i < level ? noop : this.methodFactory(methodName, level, this.name);
|
|
126
|
+
}
|
|
127
|
+
this.log = this.debug;
|
|
128
|
+
if (typeof console === undefinedType && level < this.levels.SILENT) {
|
|
129
|
+
return "No console available for logging";
|
|
163
130
|
}
|
|
164
131
|
}
|
|
165
|
-
function
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
132
|
+
function enableLoggingWhenConsoleArrives(methodName) {
|
|
133
|
+
return function() {
|
|
134
|
+
if (typeof console !== undefinedType) {
|
|
135
|
+
replaceLoggingMethods.call(this);
|
|
136
|
+
this[methodName].apply(this, arguments);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function defaultMethodFactory(methodName, _level, _loggerName) {
|
|
141
|
+
return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments);
|
|
142
|
+
}
|
|
143
|
+
function Logger(name, factory) {
|
|
144
|
+
var self2 = this;
|
|
145
|
+
var inheritedLevel;
|
|
146
|
+
var defaultLevel;
|
|
147
|
+
var userLevel;
|
|
148
|
+
var storageKey = "loglevel";
|
|
149
|
+
if (typeof name === "string") {
|
|
150
|
+
storageKey += ":" + name;
|
|
151
|
+
} else if (typeof name === "symbol") {
|
|
152
|
+
storageKey = void 0;
|
|
172
153
|
}
|
|
173
|
-
|
|
154
|
+
function persistLevelIfPossible(levelNum) {
|
|
155
|
+
var levelName = (logMethods[levelNum] || "silent").toUpperCase();
|
|
156
|
+
if (typeof window === undefinedType || !storageKey) return;
|
|
174
157
|
try {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
)[1];
|
|
182
|
-
}
|
|
158
|
+
window.localStorage[storageKey] = levelName;
|
|
159
|
+
return;
|
|
160
|
+
} catch (ignore) {
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
|
|
183
164
|
} catch (ignore) {
|
|
184
165
|
}
|
|
185
166
|
}
|
|
186
|
-
|
|
187
|
-
storedLevel
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
167
|
+
function getPersistedLevel() {
|
|
168
|
+
var storedLevel;
|
|
169
|
+
if (typeof window === undefinedType || !storageKey) return;
|
|
170
|
+
try {
|
|
171
|
+
storedLevel = window.localStorage[storageKey];
|
|
172
|
+
} catch (ignore) {
|
|
173
|
+
}
|
|
174
|
+
if (typeof storedLevel === undefinedType) {
|
|
175
|
+
try {
|
|
176
|
+
var cookie = window.document.cookie;
|
|
177
|
+
var cookieName = encodeURIComponent(storageKey);
|
|
178
|
+
var location = cookie.indexOf(cookieName + "=");
|
|
179
|
+
if (location !== -1) {
|
|
180
|
+
storedLevel = /^([^;]+)/.exec(
|
|
181
|
+
cookie.slice(location + cookieName.length + 1)
|
|
182
|
+
)[1];
|
|
183
|
+
}
|
|
184
|
+
} catch (ignore) {
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (self2.levels[storedLevel] === void 0) {
|
|
188
|
+
storedLevel = void 0;
|
|
189
|
+
}
|
|
190
|
+
return storedLevel;
|
|
197
191
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
192
|
+
function clearPersistedLevel() {
|
|
193
|
+
if (typeof window === undefinedType || !storageKey) return;
|
|
194
|
+
try {
|
|
195
|
+
window.localStorage.removeItem(storageKey);
|
|
196
|
+
} catch (ignore) {
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
200
|
+
} catch (ignore) {
|
|
201
|
+
}
|
|
201
202
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
function normalizeLevel(input) {
|
|
204
|
+
var level = input;
|
|
205
|
+
if (typeof level === "string" && self2.levels[level.toUpperCase()] !== void 0) {
|
|
206
|
+
level = self2.levels[level.toUpperCase()];
|
|
207
|
+
}
|
|
208
|
+
if (typeof level === "number" && level >= 0 && level <= self2.levels.SILENT) {
|
|
209
|
+
return level;
|
|
210
|
+
} else {
|
|
211
|
+
throw new TypeError("log.setLevel() called with invalid level: " + input);
|
|
212
|
+
}
|
|
207
213
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
214
|
+
self2.name = name;
|
|
215
|
+
self2.levels = {
|
|
216
|
+
"TRACE": 0,
|
|
217
|
+
"DEBUG": 1,
|
|
218
|
+
"INFO": 2,
|
|
219
|
+
"WARN": 3,
|
|
220
|
+
"ERROR": 4,
|
|
221
|
+
"SILENT": 5
|
|
222
|
+
};
|
|
223
|
+
self2.methodFactory = factory || defaultMethodFactory;
|
|
224
|
+
self2.getLevel = function() {
|
|
225
|
+
if (userLevel != null) {
|
|
226
|
+
return userLevel;
|
|
227
|
+
} else if (defaultLevel != null) {
|
|
228
|
+
return defaultLevel;
|
|
229
|
+
} else {
|
|
230
|
+
return inheritedLevel;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
self2.setLevel = function(level, persist) {
|
|
234
|
+
userLevel = normalizeLevel(level);
|
|
235
|
+
if (persist !== false) {
|
|
236
|
+
persistLevelIfPossible(userLevel);
|
|
237
|
+
}
|
|
238
|
+
return replaceLoggingMethods.call(self2);
|
|
239
|
+
};
|
|
240
|
+
self2.setDefaultLevel = function(level) {
|
|
241
|
+
defaultLevel = normalizeLevel(level);
|
|
242
|
+
if (!getPersistedLevel()) {
|
|
243
|
+
self2.setLevel(level, false);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
self2.resetLevel = function() {
|
|
247
|
+
userLevel = null;
|
|
248
|
+
clearPersistedLevel();
|
|
249
|
+
replaceLoggingMethods.call(self2);
|
|
250
|
+
};
|
|
251
|
+
self2.enableAll = function(persist) {
|
|
252
|
+
self2.setLevel(self2.levels.TRACE, persist);
|
|
253
|
+
};
|
|
254
|
+
self2.disableAll = function(persist) {
|
|
255
|
+
self2.setLevel(self2.levels.SILENT, persist);
|
|
256
|
+
};
|
|
257
|
+
self2.rebuild = function() {
|
|
258
|
+
if (defaultLogger !== self2) {
|
|
259
|
+
inheritedLevel = normalizeLevel(defaultLogger.getLevel());
|
|
260
|
+
}
|
|
261
|
+
replaceLoggingMethods.call(self2);
|
|
262
|
+
if (defaultLogger === self2) {
|
|
263
|
+
for (var childName in _loggersByName) {
|
|
264
|
+
_loggersByName[childName].rebuild();
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
inheritedLevel = normalizeLevel(
|
|
269
|
+
defaultLogger ? defaultLogger.getLevel() : "WARN"
|
|
270
|
+
);
|
|
271
|
+
var initialLevel = getPersistedLevel();
|
|
272
|
+
if (initialLevel != null) {
|
|
273
|
+
userLevel = normalizeLevel(initialLevel);
|
|
212
274
|
}
|
|
275
|
+
replaceLoggingMethods.call(self2);
|
|
213
276
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
"
|
|
217
|
-
|
|
218
|
-
"INFO": 2,
|
|
219
|
-
"WARN": 3,
|
|
220
|
-
"ERROR": 4,
|
|
221
|
-
"SILENT": 5
|
|
222
|
-
};
|
|
223
|
-
self2.methodFactory = factory || defaultMethodFactory;
|
|
224
|
-
self2.getLevel = function() {
|
|
225
|
-
if (userLevel != null) {
|
|
226
|
-
return userLevel;
|
|
227
|
-
} else if (defaultLevel != null) {
|
|
228
|
-
return defaultLevel;
|
|
229
|
-
} else {
|
|
230
|
-
return inheritedLevel;
|
|
277
|
+
defaultLogger = new Logger();
|
|
278
|
+
defaultLogger.getLogger = function getLogger(name) {
|
|
279
|
+
if (typeof name !== "symbol" && typeof name !== "string" || name === "") {
|
|
280
|
+
throw new TypeError("You must supply a name when creating a logger.");
|
|
231
281
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
282
|
+
var logger = _loggersByName[name];
|
|
283
|
+
if (!logger) {
|
|
284
|
+
logger = _loggersByName[name] = new Logger(
|
|
285
|
+
name,
|
|
286
|
+
defaultLogger.methodFactory
|
|
287
|
+
);
|
|
237
288
|
}
|
|
238
|
-
return
|
|
289
|
+
return logger;
|
|
239
290
|
};
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (
|
|
243
|
-
|
|
291
|
+
var _log = typeof window !== undefinedType ? window.log : void 0;
|
|
292
|
+
defaultLogger.noConflict = function() {
|
|
293
|
+
if (typeof window !== undefinedType && window.log === defaultLogger) {
|
|
294
|
+
window.log = _log;
|
|
244
295
|
}
|
|
296
|
+
return defaultLogger;
|
|
245
297
|
};
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
clearPersistedLevel();
|
|
249
|
-
replaceLoggingMethods.call(self2);
|
|
250
|
-
};
|
|
251
|
-
self2.enableAll = function(persist) {
|
|
252
|
-
self2.setLevel(self2.levels.TRACE, persist);
|
|
298
|
+
defaultLogger.getLoggers = function getLoggers() {
|
|
299
|
+
return _loggersByName;
|
|
253
300
|
};
|
|
254
|
-
|
|
255
|
-
self2.setLevel(self2.levels.SILENT, persist);
|
|
256
|
-
};
|
|
257
|
-
self2.rebuild = function() {
|
|
258
|
-
if (defaultLogger !== self2) {
|
|
259
|
-
inheritedLevel = normalizeLevel(defaultLogger.getLevel());
|
|
260
|
-
}
|
|
261
|
-
replaceLoggingMethods.call(self2);
|
|
262
|
-
if (defaultLogger === self2) {
|
|
263
|
-
for (var childName in _loggersByName) {
|
|
264
|
-
_loggersByName[childName].rebuild();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
inheritedLevel = normalizeLevel(
|
|
269
|
-
defaultLogger ? defaultLogger.getLevel() : "WARN"
|
|
270
|
-
);
|
|
271
|
-
var initialLevel = getPersistedLevel();
|
|
272
|
-
if (initialLevel != null) {
|
|
273
|
-
userLevel = normalizeLevel(initialLevel);
|
|
274
|
-
}
|
|
275
|
-
replaceLoggingMethods.call(self2);
|
|
276
|
-
}
|
|
277
|
-
defaultLogger = new Logger();
|
|
278
|
-
defaultLogger.getLogger = function getLogger(name) {
|
|
279
|
-
if (typeof name !== "symbol" && typeof name !== "string" || name === "") {
|
|
280
|
-
throw new TypeError("You must supply a name when creating a logger.");
|
|
281
|
-
}
|
|
282
|
-
var logger = _loggersByName[name];
|
|
283
|
-
if (!logger) {
|
|
284
|
-
logger = _loggersByName[name] = new Logger(
|
|
285
|
-
name,
|
|
286
|
-
defaultLogger.methodFactory
|
|
287
|
-
);
|
|
288
|
-
}
|
|
289
|
-
return logger;
|
|
290
|
-
};
|
|
291
|
-
var _log = typeof window !== undefinedType ? window.log : void 0;
|
|
292
|
-
defaultLogger.noConflict = function() {
|
|
293
|
-
if (typeof window !== undefinedType && window.log === defaultLogger) {
|
|
294
|
-
window.log = _log;
|
|
295
|
-
}
|
|
301
|
+
defaultLogger["default"] = defaultLogger;
|
|
296
302
|
return defaultLogger;
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return defaultLogger;
|
|
303
|
-
});
|
|
304
|
-
})(loglevel);
|
|
303
|
+
});
|
|
304
|
+
})(loglevel$1);
|
|
305
|
+
return loglevel$1.exports;
|
|
306
|
+
}
|
|
307
|
+
requireLoglevel();
|
|
305
308
|
/**
|
|
306
309
|
* @license
|
|
307
310
|
* Copyright 2010-2023 Three.js Authors
|
|
@@ -354,8 +357,7 @@ const WebGLCoordinateSystem = 2e3;
|
|
|
354
357
|
const WebGPUCoordinateSystem = 2001;
|
|
355
358
|
class EventDispatcher {
|
|
356
359
|
addEventListener(type, listener) {
|
|
357
|
-
if (this._listeners === void 0)
|
|
358
|
-
this._listeners = {};
|
|
360
|
+
if (this._listeners === void 0) this._listeners = {};
|
|
359
361
|
const listeners = this._listeners;
|
|
360
362
|
if (listeners[type] === void 0) {
|
|
361
363
|
listeners[type] = [];
|
|
@@ -365,14 +367,12 @@ class EventDispatcher {
|
|
|
365
367
|
}
|
|
366
368
|
}
|
|
367
369
|
hasEventListener(type, listener) {
|
|
368
|
-
if (this._listeners === void 0)
|
|
369
|
-
return false;
|
|
370
|
+
if (this._listeners === void 0) return false;
|
|
370
371
|
const listeners = this._listeners;
|
|
371
372
|
return listeners[type] !== void 0 && listeners[type].indexOf(listener) !== -1;
|
|
372
373
|
}
|
|
373
374
|
removeEventListener(type, listener) {
|
|
374
|
-
if (this._listeners === void 0)
|
|
375
|
-
return;
|
|
375
|
+
if (this._listeners === void 0) return;
|
|
376
376
|
const listeners = this._listeners;
|
|
377
377
|
const listenerArray = listeners[type];
|
|
378
378
|
if (listenerArray !== void 0) {
|
|
@@ -383,8 +383,7 @@ class EventDispatcher {
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
dispatchEvent(event) {
|
|
386
|
-
if (this._listeners === void 0)
|
|
387
|
-
return;
|
|
386
|
+
if (this._listeners === void 0) return;
|
|
388
387
|
const listeners = this._listeners;
|
|
389
388
|
const listenerArray = listeners[event.type];
|
|
390
389
|
if (listenerArray !== void 0) {
|
|
@@ -435,18 +434,14 @@ function pingpong(x, length = 1) {
|
|
|
435
434
|
return length - Math.abs(euclideanModulo(x, length * 2) - length);
|
|
436
435
|
}
|
|
437
436
|
function smoothstep(x, min, max) {
|
|
438
|
-
if (x <= min)
|
|
439
|
-
|
|
440
|
-
if (x >= max)
|
|
441
|
-
return 1;
|
|
437
|
+
if (x <= min) return 0;
|
|
438
|
+
if (x >= max) return 1;
|
|
442
439
|
x = (x - min) / (max - min);
|
|
443
440
|
return x * x * (3 - 2 * x);
|
|
444
441
|
}
|
|
445
442
|
function smootherstep(x, min, max) {
|
|
446
|
-
if (x <= min)
|
|
447
|
-
|
|
448
|
-
if (x >= max)
|
|
449
|
-
return 1;
|
|
443
|
+
if (x <= min) return 0;
|
|
444
|
+
if (x >= max) return 1;
|
|
450
445
|
x = (x - min) / (max - min);
|
|
451
446
|
return x * x * x * (x * (x * 6 - 15) + 10);
|
|
452
447
|
}
|
|
@@ -460,8 +455,7 @@ function randFloatSpread(range) {
|
|
|
460
455
|
return range * (0.5 - Math.random());
|
|
461
456
|
}
|
|
462
457
|
function seededRandom(s) {
|
|
463
|
-
if (s !== void 0)
|
|
464
|
-
_seed = s;
|
|
458
|
+
if (s !== void 0) _seed = s;
|
|
465
459
|
let t = _seed += 1831565813;
|
|
466
460
|
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
467
461
|
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
@@ -782,8 +776,7 @@ class Vector2 {
|
|
|
782
776
|
}
|
|
783
777
|
angleTo(v) {
|
|
784
778
|
const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());
|
|
785
|
-
if (denominator === 0)
|
|
786
|
-
return Math.PI / 2;
|
|
779
|
+
if (denominator === 0) return Math.PI / 2;
|
|
787
780
|
const theta = this.dot(v) / denominator;
|
|
788
781
|
return Math.acos(clamp(theta, -1, 1));
|
|
789
782
|
}
|
|
@@ -973,8 +966,7 @@ class Matrix3 {
|
|
|
973
966
|
}
|
|
974
967
|
invert() {
|
|
975
968
|
const te = this.elements, n11 = te[0], n21 = te[1], n31 = te[2], n12 = te[3], n22 = te[4], n32 = te[5], n13 = te[6], n23 = te[7], n33 = te[8], t11 = n33 * n22 - n32 * n23, t12 = n32 * n13 - n33 * n12, t13 = n23 * n12 - n22 * n13, det = n11 * t11 + n21 * t12 + n31 * t13;
|
|
976
|
-
if (det === 0)
|
|
977
|
-
return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
969
|
+
if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
978
970
|
const detInv = 1 / det;
|
|
979
971
|
te[0] = t11 * detInv;
|
|
980
972
|
te[1] = (n31 * n23 - n33 * n21) * detInv;
|
|
@@ -1110,8 +1102,7 @@ class Matrix3 {
|
|
|
1110
1102
|
const te = this.elements;
|
|
1111
1103
|
const me = matrix.elements;
|
|
1112
1104
|
for (let i = 0; i < 9; i++) {
|
|
1113
|
-
if (te[i] !== me[i])
|
|
1114
|
-
return false;
|
|
1105
|
+
if (te[i] !== me[i]) return false;
|
|
1115
1106
|
}
|
|
1116
1107
|
return true;
|
|
1117
1108
|
}
|
|
@@ -1141,8 +1132,7 @@ class Matrix3 {
|
|
|
1141
1132
|
const _m3 = /* @__PURE__ */ new Matrix3();
|
|
1142
1133
|
function arrayNeedsUint32(array) {
|
|
1143
1134
|
for (let i = array.length - 1; i >= 0; --i) {
|
|
1144
|
-
if (array[i] >= 65535)
|
|
1145
|
-
return true;
|
|
1135
|
+
if (array[i] >= 65535) return true;
|
|
1146
1136
|
}
|
|
1147
1137
|
return false;
|
|
1148
1138
|
}
|
|
@@ -1151,8 +1141,7 @@ function createElementNS(name) {
|
|
|
1151
1141
|
}
|
|
1152
1142
|
const _cache = {};
|
|
1153
1143
|
function warnOnce(message) {
|
|
1154
|
-
if (message in _cache)
|
|
1155
|
-
return;
|
|
1144
|
+
if (message in _cache) return;
|
|
1156
1145
|
_cache[message] = true;
|
|
1157
1146
|
console.warn(message);
|
|
1158
1147
|
}
|
|
@@ -1247,8 +1236,7 @@ class ImageUtils {
|
|
|
1247
1236
|
if (image instanceof HTMLCanvasElement) {
|
|
1248
1237
|
canvas = image;
|
|
1249
1238
|
} else {
|
|
1250
|
-
if (_canvas === void 0)
|
|
1251
|
-
_canvas = createElementNS("canvas");
|
|
1239
|
+
if (_canvas === void 0) _canvas = createElementNS("canvas");
|
|
1252
1240
|
_canvas.width = image.width;
|
|
1253
1241
|
_canvas.height = image.height;
|
|
1254
1242
|
const context = _canvas.getContext("2d");
|
|
@@ -1310,8 +1298,7 @@ class Source {
|
|
|
1310
1298
|
this.version = 0;
|
|
1311
1299
|
}
|
|
1312
1300
|
set needsUpdate(value) {
|
|
1313
|
-
if (value === true)
|
|
1314
|
-
this.version++;
|
|
1301
|
+
if (value === true) this.version++;
|
|
1315
1302
|
}
|
|
1316
1303
|
toJSON(meta) {
|
|
1317
1304
|
const isRootObject = meta === void 0 || typeof meta === "string";
|
|
@@ -1478,8 +1465,7 @@ class Texture extends EventDispatcher {
|
|
|
1478
1465
|
premultiplyAlpha: this.premultiplyAlpha,
|
|
1479
1466
|
unpackAlignment: this.unpackAlignment
|
|
1480
1467
|
};
|
|
1481
|
-
if (Object.keys(this.userData).length > 0)
|
|
1482
|
-
output.userData = this.userData;
|
|
1468
|
+
if (Object.keys(this.userData).length > 0) output.userData = this.userData;
|
|
1483
1469
|
if (!isRootObject) {
|
|
1484
1470
|
meta.textures[this.uuid] = output;
|
|
1485
1471
|
}
|
|
@@ -1489,8 +1475,7 @@ class Texture extends EventDispatcher {
|
|
|
1489
1475
|
this.dispatchEvent({ type: "dispose" });
|
|
1490
1476
|
}
|
|
1491
1477
|
transformUv(uv) {
|
|
1492
|
-
if (this.mapping !== UVMapping)
|
|
1493
|
-
return uv;
|
|
1478
|
+
if (this.mapping !== UVMapping) return uv;
|
|
1494
1479
|
uv.applyMatrix3(this.matrix);
|
|
1495
1480
|
if (uv.x < 0 || uv.x > 1) {
|
|
1496
1481
|
switch (this.wrapS) {
|
|
@@ -1781,8 +1766,7 @@ class Vector4 {
|
|
|
1781
1766
|
return this;
|
|
1782
1767
|
}
|
|
1783
1768
|
let s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12));
|
|
1784
|
-
if (Math.abs(s) < 1e-3)
|
|
1785
|
-
s = 1;
|
|
1769
|
+
if (Math.abs(s) < 1e-3) s = 1;
|
|
1786
1770
|
this.x = (m32 - m23) / s;
|
|
1787
1771
|
this.y = (m13 - m31) / s;
|
|
1788
1772
|
this.z = (m21 - m12) / s;
|
|
@@ -2089,8 +2073,7 @@ class Quaternion {
|
|
|
2089
2073
|
default:
|
|
2090
2074
|
console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + order);
|
|
2091
2075
|
}
|
|
2092
|
-
if (update !== false)
|
|
2093
|
-
this._onChangeCallback();
|
|
2076
|
+
if (update !== false) this._onChangeCallback();
|
|
2094
2077
|
return this;
|
|
2095
2078
|
}
|
|
2096
2079
|
setFromAxisAngle(axis, angle) {
|
|
@@ -2160,8 +2143,7 @@ class Quaternion {
|
|
|
2160
2143
|
}
|
|
2161
2144
|
rotateTowards(q, step) {
|
|
2162
2145
|
const angle = this.angleTo(q);
|
|
2163
|
-
if (angle === 0)
|
|
2164
|
-
return this;
|
|
2146
|
+
if (angle === 0) return this;
|
|
2165
2147
|
const t = Math.min(1, step / angle);
|
|
2166
2148
|
this.slerp(q, t);
|
|
2167
2149
|
return this;
|
|
@@ -2222,10 +2204,8 @@ class Quaternion {
|
|
|
2222
2204
|
return this;
|
|
2223
2205
|
}
|
|
2224
2206
|
slerp(qb, t) {
|
|
2225
|
-
if (t === 0)
|
|
2226
|
-
|
|
2227
|
-
if (t === 1)
|
|
2228
|
-
return this.copy(qb);
|
|
2207
|
+
if (t === 0) return this;
|
|
2208
|
+
if (t === 1) return this.copy(qb);
|
|
2229
2209
|
const x = this._x, y = this._y, z = this._z, w = this._w;
|
|
2230
2210
|
let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;
|
|
2231
2211
|
if (cosHalfTheta < 0) {
|
|
@@ -2330,8 +2310,7 @@ class Vector3 {
|
|
|
2330
2310
|
this.z = z;
|
|
2331
2311
|
}
|
|
2332
2312
|
set(x, y, z) {
|
|
2333
|
-
if (z === void 0)
|
|
2334
|
-
z = this.z;
|
|
2313
|
+
if (z === void 0) z = this.z;
|
|
2335
2314
|
this.x = x;
|
|
2336
2315
|
this.y = y;
|
|
2337
2316
|
this.z = z;
|
|
@@ -2615,8 +2594,7 @@ class Vector3 {
|
|
|
2615
2594
|
}
|
|
2616
2595
|
projectOnVector(v) {
|
|
2617
2596
|
const denominator = v.lengthSq();
|
|
2618
|
-
if (denominator === 0)
|
|
2619
|
-
return this.set(0, 0, 0);
|
|
2597
|
+
if (denominator === 0) return this.set(0, 0, 0);
|
|
2620
2598
|
const scalar = v.dot(this) / denominator;
|
|
2621
2599
|
return this.copy(v).multiplyScalar(scalar);
|
|
2622
2600
|
}
|
|
@@ -2629,8 +2607,7 @@ class Vector3 {
|
|
|
2629
2607
|
}
|
|
2630
2608
|
angleTo(v) {
|
|
2631
2609
|
const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());
|
|
2632
|
-
if (denominator === 0)
|
|
2633
|
-
return Math.PI / 2;
|
|
2610
|
+
if (denominator === 0) return Math.PI / 2;
|
|
2634
2611
|
const theta = this.dot(v) / denominator;
|
|
2635
2612
|
return Math.acos(clamp(theta, -1, 1));
|
|
2636
2613
|
}
|
|
@@ -2969,8 +2946,7 @@ class Box3 {
|
|
|
2969
2946
|
intersect(box) {
|
|
2970
2947
|
this.min.max(box.min);
|
|
2971
2948
|
this.max.min(box.max);
|
|
2972
|
-
if (this.isEmpty())
|
|
2973
|
-
this.makeEmpty();
|
|
2949
|
+
if (this.isEmpty()) this.makeEmpty();
|
|
2974
2950
|
return this;
|
|
2975
2951
|
}
|
|
2976
2952
|
union(box) {
|
|
@@ -2979,8 +2955,7 @@ class Box3 {
|
|
|
2979
2955
|
return this;
|
|
2980
2956
|
}
|
|
2981
2957
|
applyMatrix4(matrix) {
|
|
2982
|
-
if (this.isEmpty())
|
|
2983
|
-
return this;
|
|
2958
|
+
if (this.isEmpty()) return this;
|
|
2984
2959
|
_points[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(matrix);
|
|
2985
2960
|
_points[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(matrix);
|
|
2986
2961
|
_points[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(matrix);
|
|
@@ -3276,15 +3251,12 @@ class Ray {
|
|
|
3276
3251
|
const tca = _vector$9.dot(this.direction);
|
|
3277
3252
|
const d2 = _vector$9.dot(_vector$9) - tca * tca;
|
|
3278
3253
|
const radius2 = sphere.radius * sphere.radius;
|
|
3279
|
-
if (d2 > radius2)
|
|
3280
|
-
return null;
|
|
3254
|
+
if (d2 > radius2) return null;
|
|
3281
3255
|
const thc = Math.sqrt(radius2 - d2);
|
|
3282
3256
|
const t0 = tca - thc;
|
|
3283
3257
|
const t1 = tca + thc;
|
|
3284
|
-
if (t1 < 0)
|
|
3285
|
-
|
|
3286
|
-
if (t0 < 0)
|
|
3287
|
-
return this.at(t1, target);
|
|
3258
|
+
if (t1 < 0) return null;
|
|
3259
|
+
if (t0 < 0) return this.at(t1, target);
|
|
3288
3260
|
return this.at(t0, target);
|
|
3289
3261
|
}
|
|
3290
3262
|
intersectsSphere(sphere) {
|
|
@@ -3337,12 +3309,9 @@ class Ray {
|
|
|
3337
3309
|
tymin = (box.max.y - origin.y) * invdiry;
|
|
3338
3310
|
tymax = (box.min.y - origin.y) * invdiry;
|
|
3339
3311
|
}
|
|
3340
|
-
if (tmin > tymax || tymin > tmax)
|
|
3341
|
-
|
|
3342
|
-
if (
|
|
3343
|
-
tmin = tymin;
|
|
3344
|
-
if (tymax < tmax || isNaN(tmax))
|
|
3345
|
-
tmax = tymax;
|
|
3312
|
+
if (tmin > tymax || tymin > tmax) return null;
|
|
3313
|
+
if (tymin > tmin || isNaN(tmin)) tmin = tymin;
|
|
3314
|
+
if (tymax < tmax || isNaN(tmax)) tmax = tymax;
|
|
3346
3315
|
if (invdirz >= 0) {
|
|
3347
3316
|
tzmin = (box.min.z - origin.z) * invdirz;
|
|
3348
3317
|
tzmax = (box.max.z - origin.z) * invdirz;
|
|
@@ -3350,14 +3319,10 @@ class Ray {
|
|
|
3350
3319
|
tzmin = (box.max.z - origin.z) * invdirz;
|
|
3351
3320
|
tzmax = (box.min.z - origin.z) * invdirz;
|
|
3352
3321
|
}
|
|
3353
|
-
if (tmin > tzmax || tzmin > tmax)
|
|
3354
|
-
|
|
3355
|
-
if (
|
|
3356
|
-
|
|
3357
|
-
if (tzmax < tmax || tmax !== tmax)
|
|
3358
|
-
tmax = tzmax;
|
|
3359
|
-
if (tmax < 0)
|
|
3360
|
-
return null;
|
|
3322
|
+
if (tmin > tzmax || tzmin > tmax) return null;
|
|
3323
|
+
if (tzmin > tmin || tmin !== tmin) tmin = tzmin;
|
|
3324
|
+
if (tzmax < tmax || tmax !== tmax) tmax = tzmax;
|
|
3325
|
+
if (tmax < 0) return null;
|
|
3361
3326
|
return this.at(tmin >= 0 ? tmin : tmax, target);
|
|
3362
3327
|
}
|
|
3363
3328
|
intersectsBox(box) {
|
|
@@ -3370,8 +3335,7 @@ class Ray {
|
|
|
3370
3335
|
let DdN = this.direction.dot(_normal$1);
|
|
3371
3336
|
let sign;
|
|
3372
3337
|
if (DdN > 0) {
|
|
3373
|
-
if (backfaceCulling)
|
|
3374
|
-
return null;
|
|
3338
|
+
if (backfaceCulling) return null;
|
|
3375
3339
|
sign = 1;
|
|
3376
3340
|
} else if (DdN < 0) {
|
|
3377
3341
|
sign = -1;
|
|
@@ -3797,8 +3761,7 @@ class Matrix4 {
|
|
|
3797
3761
|
invert() {
|
|
3798
3762
|
const te = this.elements, n11 = te[0], n21 = te[1], n31 = te[2], n41 = te[3], n12 = te[4], n22 = te[5], n32 = te[6], n42 = te[7], n13 = te[8], n23 = te[9], n33 = te[10], n43 = te[11], n14 = te[12], n24 = te[13], n34 = te[14], n44 = te[15], t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;
|
|
3799
3763
|
const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;
|
|
3800
|
-
if (det === 0)
|
|
3801
|
-
return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
3764
|
+
if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
3802
3765
|
const detInv = 1 / det;
|
|
3803
3766
|
te[0] = t11 * detInv;
|
|
3804
3767
|
te[1] = (n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44) * detInv;
|
|
@@ -4050,8 +4013,7 @@ class Matrix4 {
|
|
|
4050
4013
|
const sy = _v1$5.set(te[4], te[5], te[6]).length();
|
|
4051
4014
|
const sz = _v1$5.set(te[8], te[9], te[10]).length();
|
|
4052
4015
|
const det = this.determinant();
|
|
4053
|
-
if (det < 0)
|
|
4054
|
-
sx = -sx;
|
|
4016
|
+
if (det < 0) sx = -sx;
|
|
4055
4017
|
position.x = te[12];
|
|
4056
4018
|
position.y = te[13];
|
|
4057
4019
|
position.z = te[14];
|
|
@@ -4147,8 +4109,7 @@ class Matrix4 {
|
|
|
4147
4109
|
const te = this.elements;
|
|
4148
4110
|
const me = matrix.elements;
|
|
4149
4111
|
for (let i = 0; i < 16; i++) {
|
|
4150
|
-
if (te[i] !== me[i])
|
|
4151
|
-
return false;
|
|
4112
|
+
if (te[i] !== me[i]) return false;
|
|
4152
4113
|
}
|
|
4153
4114
|
return true;
|
|
4154
4115
|
}
|
|
@@ -4313,8 +4274,7 @@ class Euler {
|
|
|
4313
4274
|
console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + order);
|
|
4314
4275
|
}
|
|
4315
4276
|
this._order = order;
|
|
4316
|
-
if (update === true)
|
|
4317
|
-
this._onChangeCallback();
|
|
4277
|
+
if (update === true) this._onChangeCallback();
|
|
4318
4278
|
return this;
|
|
4319
4279
|
}
|
|
4320
4280
|
setFromQuaternion(q, order, update) {
|
|
@@ -4335,8 +4295,7 @@ class Euler {
|
|
|
4335
4295
|
this._x = array[0];
|
|
4336
4296
|
this._y = array[1];
|
|
4337
4297
|
this._z = array[2];
|
|
4338
|
-
if (array[3] !== void 0)
|
|
4339
|
-
this._order = array[3];
|
|
4298
|
+
if (array[3] !== void 0) this._order = array[3];
|
|
4340
4299
|
this._onChangeCallback();
|
|
4341
4300
|
return this;
|
|
4342
4301
|
}
|
|
@@ -4473,8 +4432,7 @@ class Object3D extends EventDispatcher {
|
|
|
4473
4432
|
onAfterRender() {
|
|
4474
4433
|
}
|
|
4475
4434
|
applyMatrix4(matrix) {
|
|
4476
|
-
if (this.matrixAutoUpdate)
|
|
4477
|
-
this.updateMatrix();
|
|
4435
|
+
if (this.matrixAutoUpdate) this.updateMatrix();
|
|
4478
4436
|
this.matrix.premultiply(matrix);
|
|
4479
4437
|
this.matrix.decompose(this.position, this.quaternion, this.scale);
|
|
4480
4438
|
}
|
|
@@ -4629,8 +4587,7 @@ class Object3D extends EventDispatcher {
|
|
|
4629
4587
|
return this.getObjectByProperty("name", name);
|
|
4630
4588
|
}
|
|
4631
4589
|
getObjectByProperty(name, value) {
|
|
4632
|
-
if (this[name] === value)
|
|
4633
|
-
return this;
|
|
4590
|
+
if (this[name] === value) return this;
|
|
4634
4591
|
for (let i = 0, l = this.children.length; i < l; i++) {
|
|
4635
4592
|
const child = this.children[i];
|
|
4636
4593
|
const object = child.getObjectByProperty(name, value);
|
|
@@ -4642,8 +4599,7 @@ class Object3D extends EventDispatcher {
|
|
|
4642
4599
|
}
|
|
4643
4600
|
getObjectsByProperty(name, value) {
|
|
4644
4601
|
let result = [];
|
|
4645
|
-
if (this[name] === value)
|
|
4646
|
-
result.push(this);
|
|
4602
|
+
if (this[name] === value) result.push(this);
|
|
4647
4603
|
for (let i = 0, l = this.children.length; i < l; i++) {
|
|
4648
4604
|
const childResult = this.children[i].getObjectsByProperty(name, value);
|
|
4649
4605
|
if (childResult.length > 0) {
|
|
@@ -4681,8 +4637,7 @@ class Object3D extends EventDispatcher {
|
|
|
4681
4637
|
}
|
|
4682
4638
|
}
|
|
4683
4639
|
traverseVisible(callback) {
|
|
4684
|
-
if (this.visible === false)
|
|
4685
|
-
return;
|
|
4640
|
+
if (this.visible === false) return;
|
|
4686
4641
|
callback(this);
|
|
4687
4642
|
const children = this.children;
|
|
4688
4643
|
for (let i = 0, l = children.length; i < l; i++) {
|
|
@@ -4701,8 +4656,7 @@ class Object3D extends EventDispatcher {
|
|
|
4701
4656
|
this.matrixWorldNeedsUpdate = true;
|
|
4702
4657
|
}
|
|
4703
4658
|
updateMatrixWorld(force) {
|
|
4704
|
-
if (this.matrixAutoUpdate)
|
|
4705
|
-
this.updateMatrix();
|
|
4659
|
+
if (this.matrixAutoUpdate) this.updateMatrix();
|
|
4706
4660
|
if (this.matrixWorldNeedsUpdate || force) {
|
|
4707
4661
|
if (this.parent === null) {
|
|
4708
4662
|
this.matrixWorld.copy(this.matrix);
|
|
@@ -4725,8 +4679,7 @@ class Object3D extends EventDispatcher {
|
|
|
4725
4679
|
if (updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true) {
|
|
4726
4680
|
parent.updateWorldMatrix(true, false);
|
|
4727
4681
|
}
|
|
4728
|
-
if (this.matrixAutoUpdate)
|
|
4729
|
-
this.updateMatrix();
|
|
4682
|
+
if (this.matrixAutoUpdate) this.updateMatrix();
|
|
4730
4683
|
if (this.parent === null) {
|
|
4731
4684
|
this.matrixWorld.copy(this.matrix);
|
|
4732
4685
|
} else {
|
|
@@ -4765,31 +4718,22 @@ class Object3D extends EventDispatcher {
|
|
|
4765
4718
|
const object = {};
|
|
4766
4719
|
object.uuid = this.uuid;
|
|
4767
4720
|
object.type = this.type;
|
|
4768
|
-
if (this.name !== "")
|
|
4769
|
-
|
|
4770
|
-
if (this.
|
|
4771
|
-
|
|
4772
|
-
if (this.
|
|
4773
|
-
|
|
4774
|
-
if (this.
|
|
4775
|
-
object.visible = false;
|
|
4776
|
-
if (this.frustumCulled === false)
|
|
4777
|
-
object.frustumCulled = false;
|
|
4778
|
-
if (this.renderOrder !== 0)
|
|
4779
|
-
object.renderOrder = this.renderOrder;
|
|
4780
|
-
if (Object.keys(this.userData).length > 0)
|
|
4781
|
-
object.userData = this.userData;
|
|
4721
|
+
if (this.name !== "") object.name = this.name;
|
|
4722
|
+
if (this.castShadow === true) object.castShadow = true;
|
|
4723
|
+
if (this.receiveShadow === true) object.receiveShadow = true;
|
|
4724
|
+
if (this.visible === false) object.visible = false;
|
|
4725
|
+
if (this.frustumCulled === false) object.frustumCulled = false;
|
|
4726
|
+
if (this.renderOrder !== 0) object.renderOrder = this.renderOrder;
|
|
4727
|
+
if (Object.keys(this.userData).length > 0) object.userData = this.userData;
|
|
4782
4728
|
object.layers = this.layers.mask;
|
|
4783
4729
|
object.matrix = this.matrix.toArray();
|
|
4784
4730
|
object.up = this.up.toArray();
|
|
4785
|
-
if (this.matrixAutoUpdate === false)
|
|
4786
|
-
object.matrixAutoUpdate = false;
|
|
4731
|
+
if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false;
|
|
4787
4732
|
if (this.isInstancedMesh) {
|
|
4788
4733
|
object.type = "InstancedMesh";
|
|
4789
4734
|
object.count = this.count;
|
|
4790
4735
|
object.instanceMatrix = this.instanceMatrix.toJSON();
|
|
4791
|
-
if (this.instanceColor !== null)
|
|
4792
|
-
object.instanceColor = this.instanceColor.toJSON();
|
|
4736
|
+
if (this.instanceColor !== null) object.instanceColor = this.instanceColor.toJSON();
|
|
4793
4737
|
}
|
|
4794
4738
|
function serialize(library, element) {
|
|
4795
4739
|
if (library[element.uuid] === void 0) {
|
|
@@ -4864,22 +4808,14 @@ class Object3D extends EventDispatcher {
|
|
|
4864
4808
|
const skeletons = extractFromCache(meta.skeletons);
|
|
4865
4809
|
const animations = extractFromCache(meta.animations);
|
|
4866
4810
|
const nodes = extractFromCache(meta.nodes);
|
|
4867
|
-
if (geometries.length > 0)
|
|
4868
|
-
|
|
4869
|
-
if (
|
|
4870
|
-
|
|
4871
|
-
if (
|
|
4872
|
-
|
|
4873
|
-
if (
|
|
4874
|
-
|
|
4875
|
-
if (shapes.length > 0)
|
|
4876
|
-
output.shapes = shapes;
|
|
4877
|
-
if (skeletons.length > 0)
|
|
4878
|
-
output.skeletons = skeletons;
|
|
4879
|
-
if (animations.length > 0)
|
|
4880
|
-
output.animations = animations;
|
|
4881
|
-
if (nodes.length > 0)
|
|
4882
|
-
output.nodes = nodes;
|
|
4811
|
+
if (geometries.length > 0) output.geometries = geometries;
|
|
4812
|
+
if (materials.length > 0) output.materials = materials;
|
|
4813
|
+
if (textures.length > 0) output.textures = textures;
|
|
4814
|
+
if (images.length > 0) output.images = images;
|
|
4815
|
+
if (shapes.length > 0) output.shapes = shapes;
|
|
4816
|
+
if (skeletons.length > 0) output.skeletons = skeletons;
|
|
4817
|
+
if (animations.length > 0) output.animations = animations;
|
|
4818
|
+
if (nodes.length > 0) output.nodes = nodes;
|
|
4883
4819
|
}
|
|
4884
4820
|
output.object = object;
|
|
4885
4821
|
return output;
|
|
@@ -5180,8 +5116,7 @@ class Material extends EventDispatcher {
|
|
|
5180
5116
|
return this.onBeforeCompile.toString();
|
|
5181
5117
|
}
|
|
5182
5118
|
setValues(values) {
|
|
5183
|
-
if (values === void 0)
|
|
5184
|
-
return;
|
|
5119
|
+
if (values === void 0) return;
|
|
5185
5120
|
for (const key in values) {
|
|
5186
5121
|
const newValue = values[key];
|
|
5187
5122
|
if (newValue === void 0) {
|
|
@@ -5219,36 +5154,21 @@ class Material extends EventDispatcher {
|
|
|
5219
5154
|
};
|
|
5220
5155
|
data.uuid = this.uuid;
|
|
5221
5156
|
data.type = this.type;
|
|
5222
|
-
if (this.name !== "")
|
|
5223
|
-
|
|
5224
|
-
if (this.
|
|
5225
|
-
|
|
5226
|
-
if (this.
|
|
5227
|
-
|
|
5228
|
-
if (this.
|
|
5229
|
-
|
|
5230
|
-
if (this.
|
|
5231
|
-
|
|
5232
|
-
if (this.
|
|
5233
|
-
|
|
5234
|
-
if (this.
|
|
5235
|
-
|
|
5236
|
-
if (this.
|
|
5237
|
-
data.emissive = this.emissive.getHex();
|
|
5238
|
-
if (this.emissiveIntensity && this.emissiveIntensity !== 1)
|
|
5239
|
-
data.emissiveIntensity = this.emissiveIntensity;
|
|
5240
|
-
if (this.specular && this.specular.isColor)
|
|
5241
|
-
data.specular = this.specular.getHex();
|
|
5242
|
-
if (this.specularIntensity !== void 0)
|
|
5243
|
-
data.specularIntensity = this.specularIntensity;
|
|
5244
|
-
if (this.specularColor && this.specularColor.isColor)
|
|
5245
|
-
data.specularColor = this.specularColor.getHex();
|
|
5246
|
-
if (this.shininess !== void 0)
|
|
5247
|
-
data.shininess = this.shininess;
|
|
5248
|
-
if (this.clearcoat !== void 0)
|
|
5249
|
-
data.clearcoat = this.clearcoat;
|
|
5250
|
-
if (this.clearcoatRoughness !== void 0)
|
|
5251
|
-
data.clearcoatRoughness = this.clearcoatRoughness;
|
|
5157
|
+
if (this.name !== "") data.name = this.name;
|
|
5158
|
+
if (this.color && this.color.isColor) data.color = this.color.getHex();
|
|
5159
|
+
if (this.roughness !== void 0) data.roughness = this.roughness;
|
|
5160
|
+
if (this.metalness !== void 0) data.metalness = this.metalness;
|
|
5161
|
+
if (this.sheen !== void 0) data.sheen = this.sheen;
|
|
5162
|
+
if (this.sheenColor && this.sheenColor.isColor) data.sheenColor = this.sheenColor.getHex();
|
|
5163
|
+
if (this.sheenRoughness !== void 0) data.sheenRoughness = this.sheenRoughness;
|
|
5164
|
+
if (this.emissive && this.emissive.isColor) data.emissive = this.emissive.getHex();
|
|
5165
|
+
if (this.emissiveIntensity && this.emissiveIntensity !== 1) data.emissiveIntensity = this.emissiveIntensity;
|
|
5166
|
+
if (this.specular && this.specular.isColor) data.specular = this.specular.getHex();
|
|
5167
|
+
if (this.specularIntensity !== void 0) data.specularIntensity = this.specularIntensity;
|
|
5168
|
+
if (this.specularColor && this.specularColor.isColor) data.specularColor = this.specularColor.getHex();
|
|
5169
|
+
if (this.shininess !== void 0) data.shininess = this.shininess;
|
|
5170
|
+
if (this.clearcoat !== void 0) data.clearcoat = this.clearcoat;
|
|
5171
|
+
if (this.clearcoatRoughness !== void 0) data.clearcoatRoughness = this.clearcoatRoughness;
|
|
5252
5172
|
if (this.clearcoatMap && this.clearcoatMap.isTexture) {
|
|
5253
5173
|
data.clearcoatMap = this.clearcoatMap.toJSON(meta).uuid;
|
|
5254
5174
|
}
|
|
@@ -5259,31 +5179,23 @@ class Material extends EventDispatcher {
|
|
|
5259
5179
|
data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(meta).uuid;
|
|
5260
5180
|
data.clearcoatNormalScale = this.clearcoatNormalScale.toArray();
|
|
5261
5181
|
}
|
|
5262
|
-
if (this.iridescence !== void 0)
|
|
5263
|
-
|
|
5264
|
-
if (this.
|
|
5265
|
-
data.iridescenceIOR = this.iridescenceIOR;
|
|
5266
|
-
if (this.iridescenceThicknessRange !== void 0)
|
|
5267
|
-
data.iridescenceThicknessRange = this.iridescenceThicknessRange;
|
|
5182
|
+
if (this.iridescence !== void 0) data.iridescence = this.iridescence;
|
|
5183
|
+
if (this.iridescenceIOR !== void 0) data.iridescenceIOR = this.iridescenceIOR;
|
|
5184
|
+
if (this.iridescenceThicknessRange !== void 0) data.iridescenceThicknessRange = this.iridescenceThicknessRange;
|
|
5268
5185
|
if (this.iridescenceMap && this.iridescenceMap.isTexture) {
|
|
5269
5186
|
data.iridescenceMap = this.iridescenceMap.toJSON(meta).uuid;
|
|
5270
5187
|
}
|
|
5271
5188
|
if (this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture) {
|
|
5272
5189
|
data.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(meta).uuid;
|
|
5273
5190
|
}
|
|
5274
|
-
if (this.anisotropy !== void 0)
|
|
5275
|
-
|
|
5276
|
-
if (this.anisotropyRotation !== void 0)
|
|
5277
|
-
data.anisotropyRotation = this.anisotropyRotation;
|
|
5191
|
+
if (this.anisotropy !== void 0) data.anisotropy = this.anisotropy;
|
|
5192
|
+
if (this.anisotropyRotation !== void 0) data.anisotropyRotation = this.anisotropyRotation;
|
|
5278
5193
|
if (this.anisotropyMap && this.anisotropyMap.isTexture) {
|
|
5279
5194
|
data.anisotropyMap = this.anisotropyMap.toJSON(meta).uuid;
|
|
5280
5195
|
}
|
|
5281
|
-
if (this.map && this.map.isTexture)
|
|
5282
|
-
|
|
5283
|
-
if (this.
|
|
5284
|
-
data.matcap = this.matcap.toJSON(meta).uuid;
|
|
5285
|
-
if (this.alphaMap && this.alphaMap.isTexture)
|
|
5286
|
-
data.alphaMap = this.alphaMap.toJSON(meta).uuid;
|
|
5196
|
+
if (this.map && this.map.isTexture) data.map = this.map.toJSON(meta).uuid;
|
|
5197
|
+
if (this.matcap && this.matcap.isTexture) data.matcap = this.matcap.toJSON(meta).uuid;
|
|
5198
|
+
if (this.alphaMap && this.alphaMap.isTexture) data.alphaMap = this.alphaMap.toJSON(meta).uuid;
|
|
5287
5199
|
if (this.lightMap && this.lightMap.isTexture) {
|
|
5288
5200
|
data.lightMap = this.lightMap.toJSON(meta).uuid;
|
|
5289
5201
|
data.lightMapIntensity = this.lightMapIntensity;
|
|
@@ -5306,60 +5218,36 @@ class Material extends EventDispatcher {
|
|
|
5306
5218
|
data.displacementScale = this.displacementScale;
|
|
5307
5219
|
data.displacementBias = this.displacementBias;
|
|
5308
5220
|
}
|
|
5309
|
-
if (this.roughnessMap && this.roughnessMap.isTexture)
|
|
5310
|
-
|
|
5311
|
-
if (this.
|
|
5312
|
-
|
|
5313
|
-
if (this.
|
|
5314
|
-
|
|
5315
|
-
if (this.specularMap && this.specularMap.isTexture)
|
|
5316
|
-
data.specularMap = this.specularMap.toJSON(meta).uuid;
|
|
5317
|
-
if (this.specularIntensityMap && this.specularIntensityMap.isTexture)
|
|
5318
|
-
data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid;
|
|
5319
|
-
if (this.specularColorMap && this.specularColorMap.isTexture)
|
|
5320
|
-
data.specularColorMap = this.specularColorMap.toJSON(meta).uuid;
|
|
5221
|
+
if (this.roughnessMap && this.roughnessMap.isTexture) data.roughnessMap = this.roughnessMap.toJSON(meta).uuid;
|
|
5222
|
+
if (this.metalnessMap && this.metalnessMap.isTexture) data.metalnessMap = this.metalnessMap.toJSON(meta).uuid;
|
|
5223
|
+
if (this.emissiveMap && this.emissiveMap.isTexture) data.emissiveMap = this.emissiveMap.toJSON(meta).uuid;
|
|
5224
|
+
if (this.specularMap && this.specularMap.isTexture) data.specularMap = this.specularMap.toJSON(meta).uuid;
|
|
5225
|
+
if (this.specularIntensityMap && this.specularIntensityMap.isTexture) data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid;
|
|
5226
|
+
if (this.specularColorMap && this.specularColorMap.isTexture) data.specularColorMap = this.specularColorMap.toJSON(meta).uuid;
|
|
5321
5227
|
if (this.envMap && this.envMap.isTexture) {
|
|
5322
5228
|
data.envMap = this.envMap.toJSON(meta).uuid;
|
|
5323
|
-
if (this.combine !== void 0)
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
if (this.
|
|
5327
|
-
|
|
5328
|
-
if (this.reflectivity !== void 0)
|
|
5329
|
-
data.reflectivity = this.reflectivity;
|
|
5330
|
-
if (this.refractionRatio !== void 0)
|
|
5331
|
-
data.refractionRatio = this.refractionRatio;
|
|
5229
|
+
if (this.combine !== void 0) data.combine = this.combine;
|
|
5230
|
+
}
|
|
5231
|
+
if (this.envMapIntensity !== void 0) data.envMapIntensity = this.envMapIntensity;
|
|
5232
|
+
if (this.reflectivity !== void 0) data.reflectivity = this.reflectivity;
|
|
5233
|
+
if (this.refractionRatio !== void 0) data.refractionRatio = this.refractionRatio;
|
|
5332
5234
|
if (this.gradientMap && this.gradientMap.isTexture) {
|
|
5333
5235
|
data.gradientMap = this.gradientMap.toJSON(meta).uuid;
|
|
5334
5236
|
}
|
|
5335
|
-
if (this.transmission !== void 0)
|
|
5336
|
-
|
|
5337
|
-
if (this.
|
|
5338
|
-
|
|
5339
|
-
if (this.
|
|
5340
|
-
|
|
5341
|
-
if (this.
|
|
5342
|
-
|
|
5343
|
-
if (this.
|
|
5344
|
-
|
|
5345
|
-
if (this.
|
|
5346
|
-
|
|
5347
|
-
if (this.
|
|
5348
|
-
|
|
5349
|
-
if (this.shadowSide !== null)
|
|
5350
|
-
data.shadowSide = this.shadowSide;
|
|
5351
|
-
if (this.sizeAttenuation !== void 0)
|
|
5352
|
-
data.sizeAttenuation = this.sizeAttenuation;
|
|
5353
|
-
if (this.blending !== NormalBlending)
|
|
5354
|
-
data.blending = this.blending;
|
|
5355
|
-
if (this.side !== FrontSide)
|
|
5356
|
-
data.side = this.side;
|
|
5357
|
-
if (this.vertexColors)
|
|
5358
|
-
data.vertexColors = true;
|
|
5359
|
-
if (this.opacity < 1)
|
|
5360
|
-
data.opacity = this.opacity;
|
|
5361
|
-
if (this.transparent === true)
|
|
5362
|
-
data.transparent = this.transparent;
|
|
5237
|
+
if (this.transmission !== void 0) data.transmission = this.transmission;
|
|
5238
|
+
if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;
|
|
5239
|
+
if (this.thickness !== void 0) data.thickness = this.thickness;
|
|
5240
|
+
if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;
|
|
5241
|
+
if (this.attenuationDistance !== void 0 && this.attenuationDistance !== Infinity) data.attenuationDistance = this.attenuationDistance;
|
|
5242
|
+
if (this.attenuationColor !== void 0) data.attenuationColor = this.attenuationColor.getHex();
|
|
5243
|
+
if (this.size !== void 0) data.size = this.size;
|
|
5244
|
+
if (this.shadowSide !== null) data.shadowSide = this.shadowSide;
|
|
5245
|
+
if (this.sizeAttenuation !== void 0) data.sizeAttenuation = this.sizeAttenuation;
|
|
5246
|
+
if (this.blending !== NormalBlending) data.blending = this.blending;
|
|
5247
|
+
if (this.side !== FrontSide) data.side = this.side;
|
|
5248
|
+
if (this.vertexColors) data.vertexColors = true;
|
|
5249
|
+
if (this.opacity < 1) data.opacity = this.opacity;
|
|
5250
|
+
if (this.transparent === true) data.transparent = this.transparent;
|
|
5363
5251
|
data.depthFunc = this.depthFunc;
|
|
5364
5252
|
data.depthTest = this.depthTest;
|
|
5365
5253
|
data.depthWrite = this.depthWrite;
|
|
@@ -5372,52 +5260,29 @@ class Material extends EventDispatcher {
|
|
|
5372
5260
|
data.stencilFail = this.stencilFail;
|
|
5373
5261
|
data.stencilZFail = this.stencilZFail;
|
|
5374
5262
|
data.stencilZPass = this.stencilZPass;
|
|
5375
|
-
if (this.rotation !== void 0 && this.rotation !== 0)
|
|
5376
|
-
|
|
5377
|
-
if (this.
|
|
5378
|
-
|
|
5379
|
-
if (this.
|
|
5380
|
-
|
|
5381
|
-
if (this.
|
|
5382
|
-
|
|
5383
|
-
if (this.
|
|
5384
|
-
|
|
5385
|
-
if (this.
|
|
5386
|
-
|
|
5387
|
-
if (this.
|
|
5388
|
-
|
|
5389
|
-
if (this.
|
|
5390
|
-
|
|
5391
|
-
if (this.
|
|
5392
|
-
|
|
5393
|
-
if (this.
|
|
5394
|
-
|
|
5395
|
-
if (this.
|
|
5396
|
-
|
|
5397
|
-
if (this.
|
|
5398
|
-
data.alphaToCoverage = this.alphaToCoverage;
|
|
5399
|
-
if (this.premultipliedAlpha === true)
|
|
5400
|
-
data.premultipliedAlpha = this.premultipliedAlpha;
|
|
5401
|
-
if (this.forceSinglePass === true)
|
|
5402
|
-
data.forceSinglePass = this.forceSinglePass;
|
|
5403
|
-
if (this.wireframe === true)
|
|
5404
|
-
data.wireframe = this.wireframe;
|
|
5405
|
-
if (this.wireframeLinewidth > 1)
|
|
5406
|
-
data.wireframeLinewidth = this.wireframeLinewidth;
|
|
5407
|
-
if (this.wireframeLinecap !== "round")
|
|
5408
|
-
data.wireframeLinecap = this.wireframeLinecap;
|
|
5409
|
-
if (this.wireframeLinejoin !== "round")
|
|
5410
|
-
data.wireframeLinejoin = this.wireframeLinejoin;
|
|
5411
|
-
if (this.flatShading === true)
|
|
5412
|
-
data.flatShading = this.flatShading;
|
|
5413
|
-
if (this.visible === false)
|
|
5414
|
-
data.visible = false;
|
|
5415
|
-
if (this.toneMapped === false)
|
|
5416
|
-
data.toneMapped = false;
|
|
5417
|
-
if (this.fog === false)
|
|
5418
|
-
data.fog = false;
|
|
5419
|
-
if (Object.keys(this.userData).length > 0)
|
|
5420
|
-
data.userData = this.userData;
|
|
5263
|
+
if (this.rotation !== void 0 && this.rotation !== 0) data.rotation = this.rotation;
|
|
5264
|
+
if (this.polygonOffset === true) data.polygonOffset = true;
|
|
5265
|
+
if (this.polygonOffsetFactor !== 0) data.polygonOffsetFactor = this.polygonOffsetFactor;
|
|
5266
|
+
if (this.polygonOffsetUnits !== 0) data.polygonOffsetUnits = this.polygonOffsetUnits;
|
|
5267
|
+
if (this.linewidth !== void 0 && this.linewidth !== 1) data.linewidth = this.linewidth;
|
|
5268
|
+
if (this.dashSize !== void 0) data.dashSize = this.dashSize;
|
|
5269
|
+
if (this.gapSize !== void 0) data.gapSize = this.gapSize;
|
|
5270
|
+
if (this.scale !== void 0) data.scale = this.scale;
|
|
5271
|
+
if (this.dithering === true) data.dithering = true;
|
|
5272
|
+
if (this.alphaTest > 0) data.alphaTest = this.alphaTest;
|
|
5273
|
+
if (this.alphaHash === true) data.alphaHash = this.alphaHash;
|
|
5274
|
+
if (this.alphaToCoverage === true) data.alphaToCoverage = this.alphaToCoverage;
|
|
5275
|
+
if (this.premultipliedAlpha === true) data.premultipliedAlpha = this.premultipliedAlpha;
|
|
5276
|
+
if (this.forceSinglePass === true) data.forceSinglePass = this.forceSinglePass;
|
|
5277
|
+
if (this.wireframe === true) data.wireframe = this.wireframe;
|
|
5278
|
+
if (this.wireframeLinewidth > 1) data.wireframeLinewidth = this.wireframeLinewidth;
|
|
5279
|
+
if (this.wireframeLinecap !== "round") data.wireframeLinecap = this.wireframeLinecap;
|
|
5280
|
+
if (this.wireframeLinejoin !== "round") data.wireframeLinejoin = this.wireframeLinejoin;
|
|
5281
|
+
if (this.flatShading === true) data.flatShading = this.flatShading;
|
|
5282
|
+
if (this.visible === false) data.visible = false;
|
|
5283
|
+
if (this.toneMapped === false) data.toneMapped = false;
|
|
5284
|
+
if (this.fog === false) data.fog = false;
|
|
5285
|
+
if (Object.keys(this.userData).length > 0) data.userData = this.userData;
|
|
5421
5286
|
function extractFromCache(cache) {
|
|
5422
5287
|
const values = [];
|
|
5423
5288
|
for (const key in cache) {
|
|
@@ -5430,10 +5295,8 @@ class Material extends EventDispatcher {
|
|
|
5430
5295
|
if (isRootObject) {
|
|
5431
5296
|
const textures = extractFromCache(meta.textures);
|
|
5432
5297
|
const images = extractFromCache(meta.images);
|
|
5433
|
-
if (textures.length > 0)
|
|
5434
|
-
|
|
5435
|
-
if (images.length > 0)
|
|
5436
|
-
data.images = images;
|
|
5298
|
+
if (textures.length > 0) data.textures = textures;
|
|
5299
|
+
if (images.length > 0) data.images = images;
|
|
5437
5300
|
}
|
|
5438
5301
|
return data;
|
|
5439
5302
|
}
|
|
@@ -5497,8 +5360,7 @@ class Material extends EventDispatcher {
|
|
|
5497
5360
|
this.dispatchEvent({ type: "dispose" });
|
|
5498
5361
|
}
|
|
5499
5362
|
set needsUpdate(value) {
|
|
5500
|
-
if (value === true)
|
|
5501
|
-
this.version++;
|
|
5363
|
+
if (value === true) this.version++;
|
|
5502
5364
|
}
|
|
5503
5365
|
}
|
|
5504
5366
|
const _colorKeywords = {
|
|
@@ -5654,16 +5516,11 @@ const _colorKeywords = {
|
|
|
5654
5516
|
const _hslA = { h: 0, s: 0, l: 0 };
|
|
5655
5517
|
const _hslB = { h: 0, s: 0, l: 0 };
|
|
5656
5518
|
function hue2rgb(p, q, t) {
|
|
5657
|
-
if (t < 0)
|
|
5658
|
-
|
|
5659
|
-
if (t
|
|
5660
|
-
|
|
5661
|
-
if (t <
|
|
5662
|
-
return p + (q - p) * 6 * t;
|
|
5663
|
-
if (t < 1 / 2)
|
|
5664
|
-
return q;
|
|
5665
|
-
if (t < 2 / 3)
|
|
5666
|
-
return p + (q - p) * 6 * (2 / 3 - t);
|
|
5519
|
+
if (t < 0) t += 1;
|
|
5520
|
+
if (t > 1) t -= 1;
|
|
5521
|
+
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
5522
|
+
if (t < 1 / 2) return q;
|
|
5523
|
+
if (t < 2 / 3) return p + (q - p) * 6 * (2 / 3 - t);
|
|
5667
5524
|
return p;
|
|
5668
5525
|
}
|
|
5669
5526
|
class Color {
|
|
@@ -5728,8 +5585,7 @@ class Color {
|
|
|
5728
5585
|
}
|
|
5729
5586
|
setStyle(style, colorSpace = SRGBColorSpace) {
|
|
5730
5587
|
function handleAlpha(string) {
|
|
5731
|
-
if (string === void 0)
|
|
5732
|
-
return;
|
|
5588
|
+
if (string === void 0) return;
|
|
5733
5589
|
if (parseFloat(string) < 1) {
|
|
5734
5590
|
console.warn("THREE.Color: Alpha component of " + style + " will be ignored.");
|
|
5735
5591
|
}
|
|
@@ -6065,8 +5921,7 @@ class BufferAttribute {
|
|
|
6065
5921
|
onUploadCallback() {
|
|
6066
5922
|
}
|
|
6067
5923
|
set needsUpdate(value) {
|
|
6068
|
-
if (value === true)
|
|
6069
|
-
this.version++;
|
|
5924
|
+
if (value === true) this.version++;
|
|
6070
5925
|
}
|
|
6071
5926
|
setUsage(value) {
|
|
6072
5927
|
this.usage = value;
|
|
@@ -6140,49 +5995,41 @@ class BufferAttribute {
|
|
|
6140
5995
|
}
|
|
6141
5996
|
getX(index) {
|
|
6142
5997
|
let x = this.array[index * this.itemSize];
|
|
6143
|
-
if (this.normalized)
|
|
6144
|
-
x = denormalize(x, this.array);
|
|
5998
|
+
if (this.normalized) x = denormalize(x, this.array);
|
|
6145
5999
|
return x;
|
|
6146
6000
|
}
|
|
6147
6001
|
setX(index, x) {
|
|
6148
|
-
if (this.normalized)
|
|
6149
|
-
x = normalize(x, this.array);
|
|
6002
|
+
if (this.normalized) x = normalize(x, this.array);
|
|
6150
6003
|
this.array[index * this.itemSize] = x;
|
|
6151
6004
|
return this;
|
|
6152
6005
|
}
|
|
6153
6006
|
getY(index) {
|
|
6154
6007
|
let y = this.array[index * this.itemSize + 1];
|
|
6155
|
-
if (this.normalized)
|
|
6156
|
-
y = denormalize(y, this.array);
|
|
6008
|
+
if (this.normalized) y = denormalize(y, this.array);
|
|
6157
6009
|
return y;
|
|
6158
6010
|
}
|
|
6159
6011
|
setY(index, y) {
|
|
6160
|
-
if (this.normalized)
|
|
6161
|
-
y = normalize(y, this.array);
|
|
6012
|
+
if (this.normalized) y = normalize(y, this.array);
|
|
6162
6013
|
this.array[index * this.itemSize + 1] = y;
|
|
6163
6014
|
return this;
|
|
6164
6015
|
}
|
|
6165
6016
|
getZ(index) {
|
|
6166
6017
|
let z = this.array[index * this.itemSize + 2];
|
|
6167
|
-
if (this.normalized)
|
|
6168
|
-
z = denormalize(z, this.array);
|
|
6018
|
+
if (this.normalized) z = denormalize(z, this.array);
|
|
6169
6019
|
return z;
|
|
6170
6020
|
}
|
|
6171
6021
|
setZ(index, z) {
|
|
6172
|
-
if (this.normalized)
|
|
6173
|
-
z = normalize(z, this.array);
|
|
6022
|
+
if (this.normalized) z = normalize(z, this.array);
|
|
6174
6023
|
this.array[index * this.itemSize + 2] = z;
|
|
6175
6024
|
return this;
|
|
6176
6025
|
}
|
|
6177
6026
|
getW(index) {
|
|
6178
6027
|
let w = this.array[index * this.itemSize + 3];
|
|
6179
|
-
if (this.normalized)
|
|
6180
|
-
w = denormalize(w, this.array);
|
|
6028
|
+
if (this.normalized) w = denormalize(w, this.array);
|
|
6181
6029
|
return w;
|
|
6182
6030
|
}
|
|
6183
6031
|
setW(index, w) {
|
|
6184
|
-
if (this.normalized)
|
|
6185
|
-
w = normalize(w, this.array);
|
|
6032
|
+
if (this.normalized) w = normalize(w, this.array);
|
|
6186
6033
|
this.array[index * this.itemSize + 3] = w;
|
|
6187
6034
|
return this;
|
|
6188
6035
|
}
|
|
@@ -6236,12 +6083,9 @@ class BufferAttribute {
|
|
|
6236
6083
|
array: Array.from(this.array),
|
|
6237
6084
|
normalized: this.normalized
|
|
6238
6085
|
};
|
|
6239
|
-
if (this.name !== "")
|
|
6240
|
-
|
|
6241
|
-
if (this.
|
|
6242
|
-
data.usage = this.usage;
|
|
6243
|
-
if (this.updateRange.offset !== 0 || this.updateRange.count !== -1)
|
|
6244
|
-
data.updateRange = this.updateRange;
|
|
6086
|
+
if (this.name !== "") data.name = this.name;
|
|
6087
|
+
if (this.usage !== StaticDrawUsage) data.usage = this.usage;
|
|
6088
|
+
if (this.updateRange.offset !== 0 || this.updateRange.count !== -1) data.updateRange = this.updateRange;
|
|
6245
6089
|
return data;
|
|
6246
6090
|
}
|
|
6247
6091
|
}
|
|
@@ -6527,8 +6371,7 @@ class BufferGeometry extends EventDispatcher {
|
|
|
6527
6371
|
uvB.sub(uvA);
|
|
6528
6372
|
uvC.sub(uvA);
|
|
6529
6373
|
const r = 1 / (uvB.x * uvC.y - uvC.x * uvB.y);
|
|
6530
|
-
if (!isFinite(r))
|
|
6531
|
-
return;
|
|
6374
|
+
if (!isFinite(r)) return;
|
|
6532
6375
|
sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r);
|
|
6533
6376
|
tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB, -uvC.x).multiplyScalar(r);
|
|
6534
6377
|
tan1[a].add(sdir);
|
|
@@ -6706,15 +6549,12 @@ class BufferGeometry extends EventDispatcher {
|
|
|
6706
6549
|
};
|
|
6707
6550
|
data.uuid = this.uuid;
|
|
6708
6551
|
data.type = this.type;
|
|
6709
|
-
if (this.name !== "")
|
|
6710
|
-
|
|
6711
|
-
if (Object.keys(this.userData).length > 0)
|
|
6712
|
-
data.userData = this.userData;
|
|
6552
|
+
if (this.name !== "") data.name = this.name;
|
|
6553
|
+
if (Object.keys(this.userData).length > 0) data.userData = this.userData;
|
|
6713
6554
|
if (this.parameters !== void 0) {
|
|
6714
6555
|
const parameters = this.parameters;
|
|
6715
6556
|
for (const key in parameters) {
|
|
6716
|
-
if (parameters[key] !== void 0)
|
|
6717
|
-
data[key] = parameters[key];
|
|
6557
|
+
if (parameters[key] !== void 0) data[key] = parameters[key];
|
|
6718
6558
|
}
|
|
6719
6559
|
return data;
|
|
6720
6560
|
}
|
|
@@ -6882,8 +6722,7 @@ class Mesh extends Object3D {
|
|
|
6882
6722
|
for (let i = 0, il = morphPosition.length; i < il; i++) {
|
|
6883
6723
|
const influence = morphInfluences[i];
|
|
6884
6724
|
const morphAttribute = morphPosition[i];
|
|
6885
|
-
if (influence === 0)
|
|
6886
|
-
continue;
|
|
6725
|
+
if (influence === 0) continue;
|
|
6887
6726
|
_tempA.fromBufferAttribute(morphAttribute, index);
|
|
6888
6727
|
if (morphTargetsRelative) {
|
|
6889
6728
|
_morphA.addScaledVector(_tempA, influence);
|
|
@@ -6899,24 +6738,19 @@ class Mesh extends Object3D {
|
|
|
6899
6738
|
const geometry = this.geometry;
|
|
6900
6739
|
const material = this.material;
|
|
6901
6740
|
const matrixWorld = this.matrixWorld;
|
|
6902
|
-
if (material === void 0)
|
|
6903
|
-
|
|
6904
|
-
if (geometry.boundingSphere === null)
|
|
6905
|
-
geometry.computeBoundingSphere();
|
|
6741
|
+
if (material === void 0) return;
|
|
6742
|
+
if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
|
|
6906
6743
|
_sphere$5.copy(geometry.boundingSphere);
|
|
6907
6744
|
_sphere$5.applyMatrix4(matrixWorld);
|
|
6908
6745
|
_ray$3.copy(raycaster.ray).recast(raycaster.near);
|
|
6909
6746
|
if (_sphere$5.containsPoint(_ray$3.origin) === false) {
|
|
6910
|
-
if (_ray$3.intersectSphere(_sphere$5, _sphereHitAt) === null)
|
|
6911
|
-
|
|
6912
|
-
if (_ray$3.origin.distanceToSquared(_sphereHitAt) > (raycaster.far - raycaster.near) ** 2)
|
|
6913
|
-
return;
|
|
6747
|
+
if (_ray$3.intersectSphere(_sphere$5, _sphereHitAt) === null) return;
|
|
6748
|
+
if (_ray$3.origin.distanceToSquared(_sphereHitAt) > (raycaster.far - raycaster.near) ** 2) return;
|
|
6914
6749
|
}
|
|
6915
6750
|
_inverseMatrix$3.copy(matrixWorld).invert();
|
|
6916
6751
|
_ray$3.copy(raycaster.ray).applyMatrix4(_inverseMatrix$3);
|
|
6917
6752
|
if (geometry.boundingBox !== null) {
|
|
6918
|
-
if (_ray$3.intersectsBox(geometry.boundingBox) === false)
|
|
6919
|
-
return;
|
|
6753
|
+
if (_ray$3.intersectsBox(geometry.boundingBox) === false) return;
|
|
6920
6754
|
}
|
|
6921
6755
|
this._computeIntersections(raycaster, intersects, _ray$3);
|
|
6922
6756
|
}
|
|
@@ -7007,13 +6841,11 @@ function checkIntersection(object, material, raycaster, ray, pA, pB, pC, point)
|
|
|
7007
6841
|
} else {
|
|
7008
6842
|
intersect = ray.intersectTriangle(pA, pB, pC, material.side === FrontSide, point);
|
|
7009
6843
|
}
|
|
7010
|
-
if (intersect === null)
|
|
7011
|
-
return null;
|
|
6844
|
+
if (intersect === null) return null;
|
|
7012
6845
|
_intersectionPointWorld.copy(point);
|
|
7013
6846
|
_intersectionPointWorld.applyMatrix4(object.matrixWorld);
|
|
7014
6847
|
const distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld);
|
|
7015
|
-
if (distance < raycaster.near || distance > raycaster.far)
|
|
7016
|
-
return null;
|
|
6848
|
+
if (distance < raycaster.near || distance > raycaster.far) return null;
|
|
7017
6849
|
return {
|
|
7018
6850
|
distance,
|
|
7019
6851
|
point: _intersectionPointWorld.clone(),
|
|
@@ -7233,8 +7065,7 @@ class PerspectiveCamera extends Camera {
|
|
|
7233
7065
|
height *= view.height / fullHeight;
|
|
7234
7066
|
}
|
|
7235
7067
|
const skew = this.filmOffset;
|
|
7236
|
-
if (skew !== 0)
|
|
7237
|
-
left += near * skew / this.getFilmWidth();
|
|
7068
|
+
if (skew !== 0) left += near * skew / this.getFilmWidth();
|
|
7238
7069
|
this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far, this.coordinateSystem);
|
|
7239
7070
|
this.projectionMatrixInverse.copy(this.projectionMatrix).invert();
|
|
7240
7071
|
}
|
|
@@ -7246,8 +7077,7 @@ class PerspectiveCamera extends Camera {
|
|
|
7246
7077
|
data.object.far = this.far;
|
|
7247
7078
|
data.object.focus = this.focus;
|
|
7248
7079
|
data.object.aspect = this.aspect;
|
|
7249
|
-
if (this.view !== null)
|
|
7250
|
-
data.object.view = Object.assign({}, this.view);
|
|
7080
|
+
if (this.view !== null) data.object.view = Object.assign({}, this.view);
|
|
7251
7081
|
data.object.filmGauge = this.filmGauge;
|
|
7252
7082
|
data.object.filmOffset = this.filmOffset;
|
|
7253
7083
|
return data;
|
|
@@ -7400,13 +7230,11 @@ class Frustum {
|
|
|
7400
7230
|
}
|
|
7401
7231
|
intersectsObject(object) {
|
|
7402
7232
|
if (object.boundingSphere !== void 0) {
|
|
7403
|
-
if (object.boundingSphere === null)
|
|
7404
|
-
object.computeBoundingSphere();
|
|
7233
|
+
if (object.boundingSphere === null) object.computeBoundingSphere();
|
|
7405
7234
|
_sphere$4.copy(object.boundingSphere).applyMatrix4(object.matrixWorld);
|
|
7406
7235
|
} else {
|
|
7407
7236
|
const geometry = object.geometry;
|
|
7408
|
-
if (geometry.boundingSphere === null)
|
|
7409
|
-
geometry.computeBoundingSphere();
|
|
7237
|
+
if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
|
|
7410
7238
|
_sphere$4.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld);
|
|
7411
7239
|
}
|
|
7412
7240
|
return this.intersectsSphere(_sphere$4);
|
|
@@ -7538,8 +7366,7 @@ class OrthographicCamera extends Camera {
|
|
|
7538
7366
|
data.object.bottom = this.bottom;
|
|
7539
7367
|
data.object.near = this.near;
|
|
7540
7368
|
data.object.far = this.far;
|
|
7541
|
-
if (this.view !== null)
|
|
7542
|
-
data.object.view = Object.assign({}, this.view);
|
|
7369
|
+
if (this.view !== null) data.object.view = Object.assign({}, this.view);
|
|
7543
7370
|
return data;
|
|
7544
7371
|
}
|
|
7545
7372
|
}
|
|
@@ -7564,8 +7391,7 @@ class InterleavedBuffer {
|
|
|
7564
7391
|
onUploadCallback() {
|
|
7565
7392
|
}
|
|
7566
7393
|
set needsUpdate(value) {
|
|
7567
|
-
if (value === true)
|
|
7568
|
-
this.version++;
|
|
7394
|
+
if (value === true) this.version++;
|
|
7569
7395
|
}
|
|
7570
7396
|
setUsage(value) {
|
|
7571
7397
|
this.usage = value;
|
|
@@ -7671,51 +7497,43 @@ class InterleavedBufferAttribute {
|
|
|
7671
7497
|
return this;
|
|
7672
7498
|
}
|
|
7673
7499
|
setX(index, x) {
|
|
7674
|
-
if (this.normalized)
|
|
7675
|
-
x = normalize(x, this.array);
|
|
7500
|
+
if (this.normalized) x = normalize(x, this.array);
|
|
7676
7501
|
this.data.array[index * this.data.stride + this.offset] = x;
|
|
7677
7502
|
return this;
|
|
7678
7503
|
}
|
|
7679
7504
|
setY(index, y) {
|
|
7680
|
-
if (this.normalized)
|
|
7681
|
-
y = normalize(y, this.array);
|
|
7505
|
+
if (this.normalized) y = normalize(y, this.array);
|
|
7682
7506
|
this.data.array[index * this.data.stride + this.offset + 1] = y;
|
|
7683
7507
|
return this;
|
|
7684
7508
|
}
|
|
7685
7509
|
setZ(index, z) {
|
|
7686
|
-
if (this.normalized)
|
|
7687
|
-
z = normalize(z, this.array);
|
|
7510
|
+
if (this.normalized) z = normalize(z, this.array);
|
|
7688
7511
|
this.data.array[index * this.data.stride + this.offset + 2] = z;
|
|
7689
7512
|
return this;
|
|
7690
7513
|
}
|
|
7691
7514
|
setW(index, w) {
|
|
7692
|
-
if (this.normalized)
|
|
7693
|
-
w = normalize(w, this.array);
|
|
7515
|
+
if (this.normalized) w = normalize(w, this.array);
|
|
7694
7516
|
this.data.array[index * this.data.stride + this.offset + 3] = w;
|
|
7695
7517
|
return this;
|
|
7696
7518
|
}
|
|
7697
7519
|
getX(index) {
|
|
7698
7520
|
let x = this.data.array[index * this.data.stride + this.offset];
|
|
7699
|
-
if (this.normalized)
|
|
7700
|
-
x = denormalize(x, this.array);
|
|
7521
|
+
if (this.normalized) x = denormalize(x, this.array);
|
|
7701
7522
|
return x;
|
|
7702
7523
|
}
|
|
7703
7524
|
getY(index) {
|
|
7704
7525
|
let y = this.data.array[index * this.data.stride + this.offset + 1];
|
|
7705
|
-
if (this.normalized)
|
|
7706
|
-
y = denormalize(y, this.array);
|
|
7526
|
+
if (this.normalized) y = denormalize(y, this.array);
|
|
7707
7527
|
return y;
|
|
7708
7528
|
}
|
|
7709
7529
|
getZ(index) {
|
|
7710
7530
|
let z = this.data.array[index * this.data.stride + this.offset + 2];
|
|
7711
|
-
if (this.normalized)
|
|
7712
|
-
z = denormalize(z, this.array);
|
|
7531
|
+
if (this.normalized) z = denormalize(z, this.array);
|
|
7713
7532
|
return z;
|
|
7714
7533
|
}
|
|
7715
7534
|
getW(index) {
|
|
7716
7535
|
let w = this.data.array[index * this.data.stride + this.offset + 3];
|
|
7717
|
-
if (this.normalized)
|
|
7718
|
-
w = denormalize(w, this.array);
|
|
7536
|
+
if (this.normalized) w = denormalize(w, this.array);
|
|
7719
7537
|
return w;
|
|
7720
7538
|
}
|
|
7721
7539
|
setXY(index, x, y) {
|
|
@@ -7860,28 +7678,22 @@ class SkinnedMesh extends Mesh {
|
|
|
7860
7678
|
this.bindMatrix.copy(source.bindMatrix);
|
|
7861
7679
|
this.bindMatrixInverse.copy(source.bindMatrixInverse);
|
|
7862
7680
|
this.skeleton = source.skeleton;
|
|
7863
|
-
if (source.boundingBox !== null)
|
|
7864
|
-
|
|
7865
|
-
if (source.boundingSphere !== null)
|
|
7866
|
-
this.boundingSphere = source.boundingSphere.clone();
|
|
7681
|
+
if (source.boundingBox !== null) this.boundingBox = source.boundingBox.clone();
|
|
7682
|
+
if (source.boundingSphere !== null) this.boundingSphere = source.boundingSphere.clone();
|
|
7867
7683
|
return this;
|
|
7868
7684
|
}
|
|
7869
7685
|
raycast(raycaster, intersects) {
|
|
7870
7686
|
const material = this.material;
|
|
7871
7687
|
const matrixWorld = this.matrixWorld;
|
|
7872
|
-
if (material === void 0)
|
|
7873
|
-
|
|
7874
|
-
if (this.boundingSphere === null)
|
|
7875
|
-
this.computeBoundingSphere();
|
|
7688
|
+
if (material === void 0) return;
|
|
7689
|
+
if (this.boundingSphere === null) this.computeBoundingSphere();
|
|
7876
7690
|
_sphere$3.copy(this.boundingSphere);
|
|
7877
7691
|
_sphere$3.applyMatrix4(matrixWorld);
|
|
7878
|
-
if (raycaster.ray.intersectsSphere(_sphere$3) === false)
|
|
7879
|
-
return;
|
|
7692
|
+
if (raycaster.ray.intersectsSphere(_sphere$3) === false) return;
|
|
7880
7693
|
_inverseMatrix$2.copy(matrixWorld).invert();
|
|
7881
7694
|
_ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2);
|
|
7882
7695
|
if (this.boundingBox !== null) {
|
|
7883
|
-
if (_ray$2.intersectsBox(this.boundingBox) === false)
|
|
7884
|
-
return;
|
|
7696
|
+
if (_ray$2.intersectsBox(this.boundingBox) === false) return;
|
|
7885
7697
|
}
|
|
7886
7698
|
this._computeIntersections(raycaster, intersects, _ray$2);
|
|
7887
7699
|
}
|
|
@@ -8179,13 +7991,10 @@ class InstancedMesh extends Mesh {
|
|
|
8179
7991
|
copy(source, recursive) {
|
|
8180
7992
|
super.copy(source, recursive);
|
|
8181
7993
|
this.instanceMatrix.copy(source.instanceMatrix);
|
|
8182
|
-
if (source.instanceColor !== null)
|
|
8183
|
-
this.instanceColor = source.instanceColor.clone();
|
|
7994
|
+
if (source.instanceColor !== null) this.instanceColor = source.instanceColor.clone();
|
|
8184
7995
|
this.count = source.count;
|
|
8185
|
-
if (source.boundingBox !== null)
|
|
8186
|
-
|
|
8187
|
-
if (source.boundingSphere !== null)
|
|
8188
|
-
this.boundingSphere = source.boundingSphere.clone();
|
|
7996
|
+
if (source.boundingBox !== null) this.boundingBox = source.boundingBox.clone();
|
|
7997
|
+
if (source.boundingSphere !== null) this.boundingSphere = source.boundingSphere.clone();
|
|
8189
7998
|
return this;
|
|
8190
7999
|
}
|
|
8191
8000
|
getColorAt(index, color) {
|
|
@@ -8199,14 +8008,11 @@ class InstancedMesh extends Mesh {
|
|
|
8199
8008
|
const raycastTimes = this.count;
|
|
8200
8009
|
_mesh.geometry = this.geometry;
|
|
8201
8010
|
_mesh.material = this.material;
|
|
8202
|
-
if (_mesh.material === void 0)
|
|
8203
|
-
|
|
8204
|
-
if (this.boundingSphere === null)
|
|
8205
|
-
this.computeBoundingSphere();
|
|
8011
|
+
if (_mesh.material === void 0) return;
|
|
8012
|
+
if (this.boundingSphere === null) this.computeBoundingSphere();
|
|
8206
8013
|
_sphere$2.copy(this.boundingSphere);
|
|
8207
8014
|
_sphere$2.applyMatrix4(matrixWorld);
|
|
8208
|
-
if (raycaster.ray.intersectsSphere(_sphere$2) === false)
|
|
8209
|
-
return;
|
|
8015
|
+
if (raycaster.ray.intersectsSphere(_sphere$2) === false) return;
|
|
8210
8016
|
for (let instanceId = 0; instanceId < raycastTimes; instanceId++) {
|
|
8211
8017
|
this.getMatrixAt(instanceId, _instanceLocalMatrix);
|
|
8212
8018
|
_instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix);
|
|
@@ -8302,13 +8108,11 @@ class Line extends Object3D {
|
|
|
8302
8108
|
const matrixWorld = this.matrixWorld;
|
|
8303
8109
|
const threshold = raycaster.params.Line.threshold;
|
|
8304
8110
|
const drawRange = geometry.drawRange;
|
|
8305
|
-
if (geometry.boundingSphere === null)
|
|
8306
|
-
geometry.computeBoundingSphere();
|
|
8111
|
+
if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
|
|
8307
8112
|
_sphere$1.copy(geometry.boundingSphere);
|
|
8308
8113
|
_sphere$1.applyMatrix4(matrixWorld);
|
|
8309
8114
|
_sphere$1.radius += threshold;
|
|
8310
|
-
if (raycaster.ray.intersectsSphere(_sphere$1) === false)
|
|
8311
|
-
return;
|
|
8115
|
+
if (raycaster.ray.intersectsSphere(_sphere$1) === false) return;
|
|
8312
8116
|
_inverseMatrix$1.copy(matrixWorld).invert();
|
|
8313
8117
|
_ray$1.copy(raycaster.ray).applyMatrix4(_inverseMatrix$1);
|
|
8314
8118
|
const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);
|
|
@@ -8330,12 +8134,10 @@ class Line extends Object3D {
|
|
|
8330
8134
|
vStart.fromBufferAttribute(positionAttribute, a);
|
|
8331
8135
|
vEnd.fromBufferAttribute(positionAttribute, b);
|
|
8332
8136
|
const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);
|
|
8333
|
-
if (distSq > localThresholdSq)
|
|
8334
|
-
continue;
|
|
8137
|
+
if (distSq > localThresholdSq) continue;
|
|
8335
8138
|
interRay.applyMatrix4(this.matrixWorld);
|
|
8336
8139
|
const distance = raycaster.ray.origin.distanceTo(interRay);
|
|
8337
|
-
if (distance < raycaster.near || distance > raycaster.far)
|
|
8338
|
-
continue;
|
|
8140
|
+
if (distance < raycaster.near || distance > raycaster.far) continue;
|
|
8339
8141
|
intersects.push({
|
|
8340
8142
|
distance,
|
|
8341
8143
|
// What do we want? intersection point on the ray or on the segment??
|
|
@@ -8354,12 +8156,10 @@ class Line extends Object3D {
|
|
|
8354
8156
|
vStart.fromBufferAttribute(positionAttribute, i);
|
|
8355
8157
|
vEnd.fromBufferAttribute(positionAttribute, i + 1);
|
|
8356
8158
|
const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);
|
|
8357
|
-
if (distSq > localThresholdSq)
|
|
8358
|
-
continue;
|
|
8159
|
+
if (distSq > localThresholdSq) continue;
|
|
8359
8160
|
interRay.applyMatrix4(this.matrixWorld);
|
|
8360
8161
|
const distance = raycaster.ray.origin.distanceTo(interRay);
|
|
8361
|
-
if (distance < raycaster.near || distance > raycaster.far)
|
|
8362
|
-
continue;
|
|
8162
|
+
if (distance < raycaster.near || distance > raycaster.far) continue;
|
|
8363
8163
|
intersects.push({
|
|
8364
8164
|
distance,
|
|
8365
8165
|
// What do we want? intersection point on the ray or on the segment??
|
|
@@ -8472,13 +8272,11 @@ class Points extends Object3D {
|
|
|
8472
8272
|
const matrixWorld = this.matrixWorld;
|
|
8473
8273
|
const threshold = raycaster.params.Points.threshold;
|
|
8474
8274
|
const drawRange = geometry.drawRange;
|
|
8475
|
-
if (geometry.boundingSphere === null)
|
|
8476
|
-
geometry.computeBoundingSphere();
|
|
8275
|
+
if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
|
|
8477
8276
|
_sphere.copy(geometry.boundingSphere);
|
|
8478
8277
|
_sphere.applyMatrix4(matrixWorld);
|
|
8479
8278
|
_sphere.radius += threshold;
|
|
8480
|
-
if (raycaster.ray.intersectsSphere(_sphere) === false)
|
|
8481
|
-
return;
|
|
8279
|
+
if (raycaster.ray.intersectsSphere(_sphere) === false) return;
|
|
8482
8280
|
_inverseMatrix.copy(matrixWorld).invert();
|
|
8483
8281
|
_ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);
|
|
8484
8282
|
const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);
|
|
@@ -8528,8 +8326,7 @@ function testPoint(point, index, localThresholdSq, matrixWorld, raycaster, inter
|
|
|
8528
8326
|
_ray.closestPointToPoint(point, intersectPoint);
|
|
8529
8327
|
intersectPoint.applyMatrix4(matrixWorld);
|
|
8530
8328
|
const distance = raycaster.ray.origin.distanceTo(intersectPoint);
|
|
8531
|
-
if (distance < raycaster.near || distance > raycaster.far)
|
|
8532
|
-
return;
|
|
8329
|
+
if (distance < raycaster.near || distance > raycaster.far) return;
|
|
8533
8330
|
intersects.push({
|
|
8534
8331
|
distance,
|
|
8535
8332
|
distanceToRay: Math.sqrt(rayPointDistanceSq),
|
|
@@ -8755,8 +8552,7 @@ function arraySlice(array, from, to) {
|
|
|
8755
8552
|
}
|
|
8756
8553
|
function convertArray(array, type, forceClone) {
|
|
8757
8554
|
if (!array || // let 'undefined' and 'null' pass
|
|
8758
|
-
!forceClone && array.constructor === type)
|
|
8759
|
-
return array;
|
|
8555
|
+
!forceClone && array.constructor === type) return array;
|
|
8760
8556
|
if (typeof type.BYTES_PER_ELEMENT === "number") {
|
|
8761
8557
|
return new type(array);
|
|
8762
8558
|
}
|
|
@@ -8771,8 +8567,7 @@ function getKeyframeOrder(times) {
|
|
|
8771
8567
|
}
|
|
8772
8568
|
const n = times.length;
|
|
8773
8569
|
const result = new Array(n);
|
|
8774
|
-
for (let i = 0; i !== n; ++i)
|
|
8775
|
-
result[i] = i;
|
|
8570
|
+
for (let i = 0; i !== n; ++i) result[i] = i;
|
|
8776
8571
|
result.sort(compareTime);
|
|
8777
8572
|
return result;
|
|
8778
8573
|
}
|
|
@@ -8792,11 +8587,9 @@ function flattenJSON(jsonKeys, times, values, valuePropertyName) {
|
|
|
8792
8587
|
while (key !== void 0 && key[valuePropertyName] === void 0) {
|
|
8793
8588
|
key = jsonKeys[i++];
|
|
8794
8589
|
}
|
|
8795
|
-
if (key === void 0)
|
|
8796
|
-
return;
|
|
8590
|
+
if (key === void 0) return;
|
|
8797
8591
|
let value = key[valuePropertyName];
|
|
8798
|
-
if (value === void 0)
|
|
8799
|
-
return;
|
|
8592
|
+
if (value === void 0) return;
|
|
8800
8593
|
if (Array.isArray(value)) {
|
|
8801
8594
|
do {
|
|
8802
8595
|
value = key[valuePropertyName];
|
|
@@ -8843,27 +8636,24 @@ class Interpolant {
|
|
|
8843
8636
|
seek: {
|
|
8844
8637
|
let right;
|
|
8845
8638
|
linear_scan: {
|
|
8846
|
-
forward_scan:
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
if (
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
t1 = pp[++i1];
|
|
8860
|
-
if (t < t1) {
|
|
8861
|
-
break seek;
|
|
8862
|
-
}
|
|
8639
|
+
forward_scan: if (!(t < t1)) {
|
|
8640
|
+
for (let giveUpAt = i1 + 2; ; ) {
|
|
8641
|
+
if (t1 === void 0) {
|
|
8642
|
+
if (t < t0) break forward_scan;
|
|
8643
|
+
i1 = pp.length;
|
|
8644
|
+
this._cachedIndex = i1;
|
|
8645
|
+
return this.copySampleValue_(i1 - 1);
|
|
8646
|
+
}
|
|
8647
|
+
if (i1 === giveUpAt) break;
|
|
8648
|
+
t0 = t1;
|
|
8649
|
+
t1 = pp[++i1];
|
|
8650
|
+
if (t < t1) {
|
|
8651
|
+
break seek;
|
|
8863
8652
|
}
|
|
8864
|
-
right = pp.length;
|
|
8865
|
-
break linear_scan;
|
|
8866
8653
|
}
|
|
8654
|
+
right = pp.length;
|
|
8655
|
+
break linear_scan;
|
|
8656
|
+
}
|
|
8867
8657
|
if (!(t >= t0)) {
|
|
8868
8658
|
const t1global = pp[1];
|
|
8869
8659
|
if (t < t1global) {
|
|
@@ -8875,8 +8665,7 @@ class Interpolant {
|
|
|
8875
8665
|
this._cachedIndex = 0;
|
|
8876
8666
|
return this.copySampleValue_(0);
|
|
8877
8667
|
}
|
|
8878
|
-
if (i1 === giveUpAt)
|
|
8879
|
-
break;
|
|
8668
|
+
if (i1 === giveUpAt) break;
|
|
8880
8669
|
t1 = t0;
|
|
8881
8670
|
t0 = pp[--i1 - 1];
|
|
8882
8671
|
if (t >= t0) {
|
|
@@ -9016,10 +8805,8 @@ class DiscreteInterpolant extends Interpolant {
|
|
|
9016
8805
|
}
|
|
9017
8806
|
class KeyframeTrack {
|
|
9018
8807
|
constructor(name, times, values, interpolation) {
|
|
9019
|
-
if (name === void 0)
|
|
9020
|
-
|
|
9021
|
-
if (times === void 0 || times.length === 0)
|
|
9022
|
-
throw new Error("THREE.KeyframeTrack: no keyframes in track named " + name);
|
|
8808
|
+
if (name === void 0) throw new Error("THREE.KeyframeTrack: track name is undefined");
|
|
8809
|
+
if (times === void 0 || times.length === 0) throw new Error("THREE.KeyframeTrack: no keyframes in track named " + name);
|
|
9023
8810
|
this.name = name;
|
|
9024
8811
|
this.times = convertArray(times, this.TimeBufferType);
|
|
9025
8812
|
this.values = convertArray(values, this.ValueBufferType);
|
|
@@ -9408,8 +9195,7 @@ class AnimationClip {
|
|
|
9408
9195
|
const hierarchyTracks = animation.hierarchy || [];
|
|
9409
9196
|
for (let h = 0; h < hierarchyTracks.length; h++) {
|
|
9410
9197
|
const animationKeys = hierarchyTracks[h].keys;
|
|
9411
|
-
if (!animationKeys || animationKeys.length === 0)
|
|
9412
|
-
continue;
|
|
9198
|
+
if (!animationKeys || animationKeys.length === 0) continue;
|
|
9413
9199
|
if (animationKeys[0].morphTargets) {
|
|
9414
9200
|
const morphTargetNames = {};
|
|
9415
9201
|
let k;
|
|
@@ -9548,13 +9334,11 @@ const Cache = {
|
|
|
9548
9334
|
enabled: false,
|
|
9549
9335
|
files: {},
|
|
9550
9336
|
add: function(key, file) {
|
|
9551
|
-
if (this.enabled === false)
|
|
9552
|
-
return;
|
|
9337
|
+
if (this.enabled === false) return;
|
|
9553
9338
|
this.files[key] = file;
|
|
9554
9339
|
},
|
|
9555
9340
|
get: function(key) {
|
|
9556
|
-
if (this.enabled === false)
|
|
9557
|
-
return;
|
|
9341
|
+
if (this.enabled === false) return;
|
|
9558
9342
|
return this.files[key];
|
|
9559
9343
|
},
|
|
9560
9344
|
remove: function(key) {
|
|
@@ -9627,8 +9411,7 @@ class LoadingManager {
|
|
|
9627
9411
|
for (let i = 0, l = handlers.length; i < l; i += 2) {
|
|
9628
9412
|
const regex = handlers[i];
|
|
9629
9413
|
const loader = handlers[i + 1];
|
|
9630
|
-
if (regex.global)
|
|
9631
|
-
regex.lastIndex = 0;
|
|
9414
|
+
if (regex.global) regex.lastIndex = 0;
|
|
9632
9415
|
if (regex.test(file)) {
|
|
9633
9416
|
return loader;
|
|
9634
9417
|
}
|
|
@@ -9691,17 +9474,14 @@ class FileLoader extends Loader {
|
|
|
9691
9474
|
super(manager);
|
|
9692
9475
|
}
|
|
9693
9476
|
load(url, onLoad, onProgress, onError) {
|
|
9694
|
-
if (url === void 0)
|
|
9695
|
-
|
|
9696
|
-
if (this.path !== void 0)
|
|
9697
|
-
url = this.path + url;
|
|
9477
|
+
if (url === void 0) url = "";
|
|
9478
|
+
if (this.path !== void 0) url = this.path + url;
|
|
9698
9479
|
url = this.manager.resolveURL(url);
|
|
9699
9480
|
const cached = Cache.get(url);
|
|
9700
9481
|
if (cached !== void 0) {
|
|
9701
9482
|
this.manager.itemStart(url);
|
|
9702
9483
|
setTimeout(() => {
|
|
9703
|
-
if (onLoad)
|
|
9704
|
-
onLoad(cached);
|
|
9484
|
+
if (onLoad) onLoad(cached);
|
|
9705
9485
|
this.manager.itemEnd(url);
|
|
9706
9486
|
}, 0);
|
|
9707
9487
|
return cached;
|
|
@@ -9753,8 +9533,7 @@ class FileLoader extends Loader {
|
|
|
9753
9533
|
const event = new ProgressEvent("progress", { lengthComputable, loaded, total });
|
|
9754
9534
|
for (let i = 0, il = callbacks.length; i < il; i++) {
|
|
9755
9535
|
const callback = callbacks[i];
|
|
9756
|
-
if (callback.onProgress)
|
|
9757
|
-
callback.onProgress(event);
|
|
9536
|
+
if (callback.onProgress) callback.onProgress(event);
|
|
9758
9537
|
}
|
|
9759
9538
|
controller.enqueue(value);
|
|
9760
9539
|
readData();
|
|
@@ -9797,8 +9576,7 @@ class FileLoader extends Loader {
|
|
|
9797
9576
|
delete loading[url];
|
|
9798
9577
|
for (let i = 0, il = callbacks.length; i < il; i++) {
|
|
9799
9578
|
const callback = callbacks[i];
|
|
9800
|
-
if (callback.onLoad)
|
|
9801
|
-
callback.onLoad(data);
|
|
9579
|
+
if (callback.onLoad) callback.onLoad(data);
|
|
9802
9580
|
}
|
|
9803
9581
|
}).catch((err) => {
|
|
9804
9582
|
const callbacks = loading[url];
|
|
@@ -9809,8 +9587,7 @@ class FileLoader extends Loader {
|
|
|
9809
9587
|
delete loading[url];
|
|
9810
9588
|
for (let i = 0, il = callbacks.length; i < il; i++) {
|
|
9811
9589
|
const callback = callbacks[i];
|
|
9812
|
-
if (callback.onError)
|
|
9813
|
-
callback.onError(err);
|
|
9590
|
+
if (callback.onError) callback.onError(err);
|
|
9814
9591
|
}
|
|
9815
9592
|
this.manager.itemError(url);
|
|
9816
9593
|
}).finally(() => {
|
|
@@ -9832,16 +9609,14 @@ class ImageLoader extends Loader {
|
|
|
9832
9609
|
super(manager);
|
|
9833
9610
|
}
|
|
9834
9611
|
load(url, onLoad, onProgress, onError) {
|
|
9835
|
-
if (this.path !== void 0)
|
|
9836
|
-
url = this.path + url;
|
|
9612
|
+
if (this.path !== void 0) url = this.path + url;
|
|
9837
9613
|
url = this.manager.resolveURL(url);
|
|
9838
9614
|
const scope = this;
|
|
9839
9615
|
const cached = Cache.get(url);
|
|
9840
9616
|
if (cached !== void 0) {
|
|
9841
9617
|
scope.manager.itemStart(url);
|
|
9842
9618
|
setTimeout(function() {
|
|
9843
|
-
if (onLoad)
|
|
9844
|
-
onLoad(cached);
|
|
9619
|
+
if (onLoad) onLoad(cached);
|
|
9845
9620
|
scope.manager.itemEnd(url);
|
|
9846
9621
|
}, 0);
|
|
9847
9622
|
return cached;
|
|
@@ -9850,14 +9625,12 @@ class ImageLoader extends Loader {
|
|
|
9850
9625
|
function onImageLoad() {
|
|
9851
9626
|
removeEventListeners();
|
|
9852
9627
|
Cache.add(url, this);
|
|
9853
|
-
if (onLoad)
|
|
9854
|
-
onLoad(this);
|
|
9628
|
+
if (onLoad) onLoad(this);
|
|
9855
9629
|
scope.manager.itemEnd(url);
|
|
9856
9630
|
}
|
|
9857
9631
|
function onImageError(event) {
|
|
9858
9632
|
removeEventListeners();
|
|
9859
|
-
if (onError)
|
|
9860
|
-
onError(event);
|
|
9633
|
+
if (onError) onError(event);
|
|
9861
9634
|
scope.manager.itemError(url);
|
|
9862
9635
|
scope.manager.itemEnd(url);
|
|
9863
9636
|
}
|
|
@@ -9868,8 +9641,7 @@ class ImageLoader extends Loader {
|
|
|
9868
9641
|
image.addEventListener("load", onImageLoad, false);
|
|
9869
9642
|
image.addEventListener("error", onImageError, false);
|
|
9870
9643
|
if (url.slice(0, 5) !== "data:") {
|
|
9871
|
-
if (this.crossOrigin !== void 0)
|
|
9872
|
-
image.crossOrigin = this.crossOrigin;
|
|
9644
|
+
if (this.crossOrigin !== void 0) image.crossOrigin = this.crossOrigin;
|
|
9873
9645
|
}
|
|
9874
9646
|
scope.manager.itemStart(url);
|
|
9875
9647
|
image.src = url;
|
|
@@ -9915,18 +9687,12 @@ class Light extends Object3D {
|
|
|
9915
9687
|
const data = super.toJSON(meta);
|
|
9916
9688
|
data.object.color = this.color.getHex();
|
|
9917
9689
|
data.object.intensity = this.intensity;
|
|
9918
|
-
if (this.groundColor !== void 0)
|
|
9919
|
-
|
|
9920
|
-
if (this.
|
|
9921
|
-
|
|
9922
|
-
if (this.
|
|
9923
|
-
|
|
9924
|
-
if (this.decay !== void 0)
|
|
9925
|
-
data.object.decay = this.decay;
|
|
9926
|
-
if (this.penumbra !== void 0)
|
|
9927
|
-
data.object.penumbra = this.penumbra;
|
|
9928
|
-
if (this.shadow !== void 0)
|
|
9929
|
-
data.object.shadow = this.shadow.toJSON();
|
|
9690
|
+
if (this.groundColor !== void 0) data.object.groundColor = this.groundColor.getHex();
|
|
9691
|
+
if (this.distance !== void 0) data.object.distance = this.distance;
|
|
9692
|
+
if (this.angle !== void 0) data.object.angle = this.angle;
|
|
9693
|
+
if (this.decay !== void 0) data.object.decay = this.decay;
|
|
9694
|
+
if (this.penumbra !== void 0) data.object.penumbra = this.penumbra;
|
|
9695
|
+
if (this.shadow !== void 0) data.object.shadow = this.shadow.toJSON();
|
|
9930
9696
|
return data;
|
|
9931
9697
|
}
|
|
9932
9698
|
}
|
|
@@ -10015,14 +9781,10 @@ class LightShadow {
|
|
|
10015
9781
|
}
|
|
10016
9782
|
toJSON() {
|
|
10017
9783
|
const object = {};
|
|
10018
|
-
if (this.bias !== 0)
|
|
10019
|
-
|
|
10020
|
-
if (this.
|
|
10021
|
-
|
|
10022
|
-
if (this.radius !== 1)
|
|
10023
|
-
object.radius = this.radius;
|
|
10024
|
-
if (this.mapSize.x !== 512 || this.mapSize.y !== 512)
|
|
10025
|
-
object.mapSize = this.mapSize.toArray();
|
|
9784
|
+
if (this.bias !== 0) object.bias = this.bias;
|
|
9785
|
+
if (this.normalBias !== 0) object.normalBias = this.normalBias;
|
|
9786
|
+
if (this.radius !== 1) object.radius = this.radius;
|
|
9787
|
+
if (this.mapSize.x !== 512 || this.mapSize.y !== 512) object.mapSize = this.mapSize.toArray();
|
|
10026
9788
|
object.camera = this.camera.toJSON(false).object;
|
|
10027
9789
|
delete object.camera.matrix;
|
|
10028
9790
|
return object;
|
|
@@ -10229,22 +9991,17 @@ class LoaderUtils {
|
|
|
10229
9991
|
}
|
|
10230
9992
|
static extractUrlBase(url) {
|
|
10231
9993
|
const index = url.lastIndexOf("/");
|
|
10232
|
-
if (index === -1)
|
|
10233
|
-
return "./";
|
|
9994
|
+
if (index === -1) return "./";
|
|
10234
9995
|
return url.slice(0, index + 1);
|
|
10235
9996
|
}
|
|
10236
9997
|
static resolveURL(url, path) {
|
|
10237
|
-
if (typeof url !== "string" || url === "")
|
|
10238
|
-
return "";
|
|
9998
|
+
if (typeof url !== "string" || url === "") return "";
|
|
10239
9999
|
if (/^https?:\/\//i.test(path) && /^\//.test(url)) {
|
|
10240
10000
|
path = path.replace(/(^https?:\/\/[^\/]+).*/i, "$1");
|
|
10241
10001
|
}
|
|
10242
|
-
if (/^(https?:)?\/\//i.test(url))
|
|
10243
|
-
|
|
10244
|
-
if (/^
|
|
10245
|
-
return url;
|
|
10246
|
-
if (/^blob:.*$/i.test(url))
|
|
10247
|
-
return url;
|
|
10002
|
+
if (/^(https?:)?\/\//i.test(url)) return url;
|
|
10003
|
+
if (/^data:.*,.*$/i.test(url)) return url;
|
|
10004
|
+
if (/^blob:.*$/i.test(url)) return url;
|
|
10248
10005
|
return path + url;
|
|
10249
10006
|
}
|
|
10250
10007
|
}
|
|
@@ -10265,18 +10022,15 @@ class ImageBitmapLoader extends Loader {
|
|
|
10265
10022
|
return this;
|
|
10266
10023
|
}
|
|
10267
10024
|
load(url, onLoad, onProgress, onError) {
|
|
10268
|
-
if (url === void 0)
|
|
10269
|
-
|
|
10270
|
-
if (this.path !== void 0)
|
|
10271
|
-
url = this.path + url;
|
|
10025
|
+
if (url === void 0) url = "";
|
|
10026
|
+
if (this.path !== void 0) url = this.path + url;
|
|
10272
10027
|
url = this.manager.resolveURL(url);
|
|
10273
10028
|
const scope = this;
|
|
10274
10029
|
const cached = Cache.get(url);
|
|
10275
10030
|
if (cached !== void 0) {
|
|
10276
10031
|
scope.manager.itemStart(url);
|
|
10277
10032
|
setTimeout(function() {
|
|
10278
|
-
if (onLoad)
|
|
10279
|
-
onLoad(cached);
|
|
10033
|
+
if (onLoad) onLoad(cached);
|
|
10280
10034
|
scope.manager.itemEnd(url);
|
|
10281
10035
|
}, 0);
|
|
10282
10036
|
return cached;
|
|
@@ -10290,12 +10044,10 @@ class ImageBitmapLoader extends Loader {
|
|
|
10290
10044
|
return createImageBitmap(blob, Object.assign(scope.options, { colorSpaceConversion: "none" }));
|
|
10291
10045
|
}).then(function(imageBitmap) {
|
|
10292
10046
|
Cache.add(url, imageBitmap);
|
|
10293
|
-
if (onLoad)
|
|
10294
|
-
onLoad(imageBitmap);
|
|
10047
|
+
if (onLoad) onLoad(imageBitmap);
|
|
10295
10048
|
scope.manager.itemEnd(url);
|
|
10296
10049
|
}).catch(function(e) {
|
|
10297
|
-
if (onError)
|
|
10298
|
-
onError(e);
|
|
10050
|
+
if (onError) onError(e);
|
|
10299
10051
|
scope.manager.itemError(url);
|
|
10300
10052
|
scope.manager.itemEnd(url);
|
|
10301
10053
|
});
|
|
@@ -10323,8 +10075,7 @@ class Composite {
|
|
|
10323
10075
|
getValue(array, offset) {
|
|
10324
10076
|
this.bind();
|
|
10325
10077
|
const firstValidIndex = this._targetGroup.nCachedObjects_, binding = this._bindings[firstValidIndex];
|
|
10326
|
-
if (binding !== void 0)
|
|
10327
|
-
binding.getValue(array, offset);
|
|
10078
|
+
if (binding !== void 0) binding.getValue(array, offset);
|
|
10328
10079
|
}
|
|
10329
10080
|
setValue(array, offset) {
|
|
10330
10081
|
const bindings = this._bindings;
|
|
@@ -10416,8 +10167,7 @@ class PropertyBinding {
|
|
|
10416
10167
|
return childNode;
|
|
10417
10168
|
}
|
|
10418
10169
|
const result = searchNodeSubtree(childNode.children);
|
|
10419
|
-
if (result)
|
|
10420
|
-
return result;
|
|
10170
|
+
if (result) return result;
|
|
10421
10171
|
}
|
|
10422
10172
|
return null;
|
|
10423
10173
|
};
|
|
@@ -10878,8 +10628,7 @@ class GLTFLoader extends Loader {
|
|
|
10878
10628
|
try {
|
|
10879
10629
|
extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data);
|
|
10880
10630
|
} catch (error) {
|
|
10881
|
-
if (onError)
|
|
10882
|
-
onError(error);
|
|
10631
|
+
if (onError) onError(error);
|
|
10883
10632
|
return;
|
|
10884
10633
|
}
|
|
10885
10634
|
json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content);
|
|
@@ -10890,8 +10639,7 @@ class GLTFLoader extends Loader {
|
|
|
10890
10639
|
json = data;
|
|
10891
10640
|
}
|
|
10892
10641
|
if (json.asset === void 0 || json.asset.version[0] < 2) {
|
|
10893
|
-
if (onError)
|
|
10894
|
-
onError(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
10642
|
+
if (onError) onError(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
10895
10643
|
return;
|
|
10896
10644
|
}
|
|
10897
10645
|
const parser = new GLTFParser(json, {
|
|
@@ -11002,16 +10750,14 @@ class GLTFLightsExtension {
|
|
|
11002
10750
|
const parser = this.parser;
|
|
11003
10751
|
const cacheKey = "light:" + lightIndex;
|
|
11004
10752
|
let dependency = parser.cache.get(cacheKey);
|
|
11005
|
-
if (dependency)
|
|
11006
|
-
return dependency;
|
|
10753
|
+
if (dependency) return dependency;
|
|
11007
10754
|
const json = parser.json;
|
|
11008
10755
|
const extensions = json.extensions && json.extensions[this.name] || {};
|
|
11009
10756
|
const lightDefs = extensions.lights || [];
|
|
11010
10757
|
const lightDef = lightDefs[lightIndex];
|
|
11011
10758
|
let lightNode;
|
|
11012
10759
|
const color = new Color(16777215);
|
|
11013
|
-
if (lightDef.color !== void 0)
|
|
11014
|
-
color.fromArray(lightDef.color);
|
|
10760
|
+
if (lightDef.color !== void 0) color.fromArray(lightDef.color);
|
|
11015
10761
|
const range = lightDef.range !== void 0 ? lightDef.range : 0;
|
|
11016
10762
|
switch (lightDef.type) {
|
|
11017
10763
|
case "directional":
|
|
@@ -11040,16 +10786,14 @@ class GLTFLightsExtension {
|
|
|
11040
10786
|
lightNode.position.set(0, 0, 0);
|
|
11041
10787
|
lightNode.decay = 2;
|
|
11042
10788
|
assignExtrasToUserData(lightNode, lightDef);
|
|
11043
|
-
if (lightDef.intensity !== void 0)
|
|
11044
|
-
lightNode.intensity = lightDef.intensity;
|
|
10789
|
+
if (lightDef.intensity !== void 0) lightNode.intensity = lightDef.intensity;
|
|
11045
10790
|
lightNode.name = parser.createUniqueName(lightDef.name || "light_" + lightIndex);
|
|
11046
10791
|
dependency = Promise.resolve(lightNode);
|
|
11047
10792
|
parser.cache.add(cacheKey, dependency);
|
|
11048
10793
|
return dependency;
|
|
11049
10794
|
}
|
|
11050
10795
|
getDependency(type, index) {
|
|
11051
|
-
if (type !== "light")
|
|
11052
|
-
return;
|
|
10796
|
+
if (type !== "light") return;
|
|
11053
10797
|
return this._loadLight(index);
|
|
11054
10798
|
}
|
|
11055
10799
|
createNodeAttachment(nodeIndex) {
|
|
@@ -11059,8 +10803,7 @@ class GLTFLightsExtension {
|
|
|
11059
10803
|
const nodeDef = json.nodes[nodeIndex];
|
|
11060
10804
|
const lightDef = nodeDef.extensions && nodeDef.extensions[this.name] || {};
|
|
11061
10805
|
const lightIndex = lightDef.light;
|
|
11062
|
-
if (lightIndex === void 0)
|
|
11063
|
-
return null;
|
|
10806
|
+
if (lightIndex === void 0) return null;
|
|
11064
10807
|
return this._loadLight(lightIndex).then(function(light) {
|
|
11065
10808
|
return parser._getNodeRef(self2.cache, lightIndex, light);
|
|
11066
10809
|
});
|
|
@@ -11117,8 +10860,7 @@ class GLTFMaterialsClearcoatExtension {
|
|
|
11117
10860
|
getMaterialType(materialIndex) {
|
|
11118
10861
|
const parser = this.parser;
|
|
11119
10862
|
const materialDef = parser.json.materials[materialIndex];
|
|
11120
|
-
if (!materialDef.extensions || !materialDef.extensions[this.name])
|
|
11121
|
-
return null;
|
|
10863
|
+
if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
|
|
11122
10864
|
return MeshPhysicalMaterial;
|
|
11123
10865
|
}
|
|
11124
10866
|
extendMaterialParams(materialIndex, materialParams) {
|
|
@@ -11159,8 +10901,7 @@ class GLTFMaterialsIridescenceExtension {
|
|
|
11159
10901
|
getMaterialType(materialIndex) {
|
|
11160
10902
|
const parser = this.parser;
|
|
11161
10903
|
const materialDef = parser.json.materials[materialIndex];
|
|
11162
|
-
if (!materialDef.extensions || !materialDef.extensions[this.name])
|
|
11163
|
-
return null;
|
|
10904
|
+
if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
|
|
11164
10905
|
return MeshPhysicalMaterial;
|
|
11165
10906
|
}
|
|
11166
10907
|
extendMaterialParams(materialIndex, materialParams) {
|
|
@@ -11203,8 +10944,7 @@ class GLTFMaterialsSheenExtension {
|
|
|
11203
10944
|
getMaterialType(materialIndex) {
|
|
11204
10945
|
const parser = this.parser;
|
|
11205
10946
|
const materialDef = parser.json.materials[materialIndex];
|
|
11206
|
-
if (!materialDef.extensions || !materialDef.extensions[this.name])
|
|
11207
|
-
return null;
|
|
10947
|
+
if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
|
|
11208
10948
|
return MeshPhysicalMaterial;
|
|
11209
10949
|
}
|
|
11210
10950
|
extendMaterialParams(materialIndex, materialParams) {
|
|
@@ -11241,8 +10981,7 @@ class GLTFMaterialsTransmissionExtension {
|
|
|
11241
10981
|
getMaterialType(materialIndex) {
|
|
11242
10982
|
const parser = this.parser;
|
|
11243
10983
|
const materialDef = parser.json.materials[materialIndex];
|
|
11244
|
-
if (!materialDef.extensions || !materialDef.extensions[this.name])
|
|
11245
|
-
return null;
|
|
10984
|
+
if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
|
|
11246
10985
|
return MeshPhysicalMaterial;
|
|
11247
10986
|
}
|
|
11248
10987
|
extendMaterialParams(materialIndex, materialParams) {
|
|
@@ -11270,8 +11009,7 @@ class GLTFMaterialsVolumeExtension {
|
|
|
11270
11009
|
getMaterialType(materialIndex) {
|
|
11271
11010
|
const parser = this.parser;
|
|
11272
11011
|
const materialDef = parser.json.materials[materialIndex];
|
|
11273
|
-
if (!materialDef.extensions || !materialDef.extensions[this.name])
|
|
11274
|
-
return null;
|
|
11012
|
+
if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
|
|
11275
11013
|
return MeshPhysicalMaterial;
|
|
11276
11014
|
}
|
|
11277
11015
|
extendMaterialParams(materialIndex, materialParams) {
|
|
@@ -11300,8 +11038,7 @@ class GLTFMaterialsIorExtension {
|
|
|
11300
11038
|
getMaterialType(materialIndex) {
|
|
11301
11039
|
const parser = this.parser;
|
|
11302
11040
|
const materialDef = parser.json.materials[materialIndex];
|
|
11303
|
-
if (!materialDef.extensions || !materialDef.extensions[this.name])
|
|
11304
|
-
return null;
|
|
11041
|
+
if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
|
|
11305
11042
|
return MeshPhysicalMaterial;
|
|
11306
11043
|
}
|
|
11307
11044
|
extendMaterialParams(materialIndex, materialParams) {
|
|
@@ -11323,8 +11060,7 @@ class GLTFMaterialsSpecularExtension {
|
|
|
11323
11060
|
getMaterialType(materialIndex) {
|
|
11324
11061
|
const parser = this.parser;
|
|
11325
11062
|
const materialDef = parser.json.materials[materialIndex];
|
|
11326
|
-
if (!materialDef.extensions || !materialDef.extensions[this.name])
|
|
11327
|
-
return null;
|
|
11063
|
+
if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
|
|
11328
11064
|
return MeshPhysicalMaterial;
|
|
11329
11065
|
}
|
|
11330
11066
|
extendMaterialParams(materialIndex, materialParams) {
|
|
@@ -11355,8 +11091,7 @@ class GLTFMaterialsAnisotropyExtension {
|
|
|
11355
11091
|
getMaterialType(materialIndex) {
|
|
11356
11092
|
const parser = this.parser;
|
|
11357
11093
|
const materialDef = parser.json.materials[materialIndex];
|
|
11358
|
-
if (!materialDef.extensions || !materialDef.extensions[this.name])
|
|
11359
|
-
return null;
|
|
11094
|
+
if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
|
|
11360
11095
|
return MeshPhysicalMaterial;
|
|
11361
11096
|
}
|
|
11362
11097
|
extendMaterialParams(materialIndex, materialParams) {
|
|
@@ -11422,12 +11157,10 @@ class GLTFTextureWebPExtension {
|
|
|
11422
11157
|
let loader = parser.textureLoader;
|
|
11423
11158
|
if (source.uri) {
|
|
11424
11159
|
const handler = parser.options.manager.getHandler(source.uri);
|
|
11425
|
-
if (handler !== null)
|
|
11426
|
-
loader = handler;
|
|
11160
|
+
if (handler !== null) loader = handler;
|
|
11427
11161
|
}
|
|
11428
11162
|
return this.detectSupport().then(function(isSupported) {
|
|
11429
|
-
if (isSupported)
|
|
11430
|
-
return parser.loadTextureImage(textureIndex, extension.source, loader);
|
|
11163
|
+
if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader);
|
|
11431
11164
|
if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {
|
|
11432
11165
|
throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
|
|
11433
11166
|
}
|
|
@@ -11466,12 +11199,10 @@ class GLTFTextureAVIFExtension {
|
|
|
11466
11199
|
let loader = parser.textureLoader;
|
|
11467
11200
|
if (source.uri) {
|
|
11468
11201
|
const handler = parser.options.manager.getHandler(source.uri);
|
|
11469
|
-
if (handler !== null)
|
|
11470
|
-
loader = handler;
|
|
11202
|
+
if (handler !== null) loader = handler;
|
|
11471
11203
|
}
|
|
11472
11204
|
return this.detectSupport().then(function(isSupported) {
|
|
11473
|
-
if (isSupported)
|
|
11474
|
-
return parser.loadTextureImage(textureIndex, extension.source, loader);
|
|
11205
|
+
if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader);
|
|
11475
11206
|
if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {
|
|
11476
11207
|
throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
|
|
11477
11208
|
}
|
|
@@ -11684,8 +11415,7 @@ class GLTFDracoMeshCompressionExtension {
|
|
|
11684
11415
|
for (const attributeName in geometry.attributes) {
|
|
11685
11416
|
const attribute = geometry.attributes[attributeName];
|
|
11686
11417
|
const normalized = attributeNormalizedMap[attributeName];
|
|
11687
|
-
if (normalized !== void 0)
|
|
11688
|
-
attribute.normalized = normalized;
|
|
11418
|
+
if (normalized !== void 0) attribute.normalized = normalized;
|
|
11689
11419
|
}
|
|
11690
11420
|
resolve(geometry);
|
|
11691
11421
|
}, threeAttributeMap, attributeTypeMap);
|
|
@@ -11769,25 +11499,13 @@ class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {
|
|
|
11769
11499
|
}
|
|
11770
11500
|
}
|
|
11771
11501
|
const WEBGL_CONSTANTS = {
|
|
11772
|
-
FLOAT: 5126,
|
|
11773
|
-
//FLOAT_MAT2: 35674,
|
|
11774
|
-
FLOAT_MAT3: 35675,
|
|
11775
|
-
FLOAT_MAT4: 35676,
|
|
11776
|
-
FLOAT_VEC2: 35664,
|
|
11777
|
-
FLOAT_VEC3: 35665,
|
|
11778
|
-
FLOAT_VEC4: 35666,
|
|
11779
|
-
LINEAR: 9729,
|
|
11780
|
-
REPEAT: 10497,
|
|
11781
|
-
SAMPLER_2D: 35678,
|
|
11782
11502
|
POINTS: 0,
|
|
11783
11503
|
LINES: 1,
|
|
11784
11504
|
LINE_LOOP: 2,
|
|
11785
11505
|
LINE_STRIP: 3,
|
|
11786
11506
|
TRIANGLES: 4,
|
|
11787
11507
|
TRIANGLE_STRIP: 5,
|
|
11788
|
-
TRIANGLE_FAN: 6
|
|
11789
|
-
UNSIGNED_BYTE: 5121,
|
|
11790
|
-
UNSIGNED_SHORT: 5123
|
|
11508
|
+
TRIANGLE_FAN: 6
|
|
11791
11509
|
};
|
|
11792
11510
|
const WEBGL_COMPONENT_TYPES = {
|
|
11793
11511
|
5120: Int8Array,
|
|
@@ -11886,17 +11604,12 @@ function addMorphTargets(geometry, targets, parser) {
|
|
|
11886
11604
|
let hasMorphColor = false;
|
|
11887
11605
|
for (let i = 0, il = targets.length; i < il; i++) {
|
|
11888
11606
|
const target = targets[i];
|
|
11889
|
-
if (target.POSITION !== void 0)
|
|
11890
|
-
|
|
11891
|
-
if (target.
|
|
11892
|
-
|
|
11893
|
-
if (target.COLOR_0 !== void 0)
|
|
11894
|
-
hasMorphColor = true;
|
|
11895
|
-
if (hasMorphPosition && hasMorphNormal && hasMorphColor)
|
|
11896
|
-
break;
|
|
11607
|
+
if (target.POSITION !== void 0) hasMorphPosition = true;
|
|
11608
|
+
if (target.NORMAL !== void 0) hasMorphNormal = true;
|
|
11609
|
+
if (target.COLOR_0 !== void 0) hasMorphColor = true;
|
|
11610
|
+
if (hasMorphPosition && hasMorphNormal && hasMorphColor) break;
|
|
11897
11611
|
}
|
|
11898
|
-
if (!hasMorphPosition && !hasMorphNormal && !hasMorphColor)
|
|
11899
|
-
return Promise.resolve(geometry);
|
|
11612
|
+
if (!hasMorphPosition && !hasMorphNormal && !hasMorphColor) return Promise.resolve(geometry);
|
|
11900
11613
|
const pendingPositionAccessors = [];
|
|
11901
11614
|
const pendingNormalAccessors = [];
|
|
11902
11615
|
const pendingColorAccessors = [];
|
|
@@ -11923,12 +11636,9 @@ function addMorphTargets(geometry, targets, parser) {
|
|
|
11923
11636
|
const morphPositions = accessors[0];
|
|
11924
11637
|
const morphNormals = accessors[1];
|
|
11925
11638
|
const morphColors = accessors[2];
|
|
11926
|
-
if (hasMorphPosition)
|
|
11927
|
-
|
|
11928
|
-
if (
|
|
11929
|
-
geometry.morphAttributes.normal = morphNormals;
|
|
11930
|
-
if (hasMorphColor)
|
|
11931
|
-
geometry.morphAttributes.color = morphColors;
|
|
11639
|
+
if (hasMorphPosition) geometry.morphAttributes.position = morphPositions;
|
|
11640
|
+
if (hasMorphNormal) geometry.morphAttributes.normal = morphNormals;
|
|
11641
|
+
if (hasMorphColor) geometry.morphAttributes.color = morphColors;
|
|
11932
11642
|
geometry.morphTargetsRelative = true;
|
|
11933
11643
|
return geometry;
|
|
11934
11644
|
});
|
|
@@ -11990,10 +11700,8 @@ function getNormalizedComponentScale(constructor) {
|
|
|
11990
11700
|
}
|
|
11991
11701
|
}
|
|
11992
11702
|
function getImageURIMimeType(uri) {
|
|
11993
|
-
if (uri.search(/\.jpe?g($|\?)/i) > 0 || uri.search(/^data\:image\/jpeg/) === 0)
|
|
11994
|
-
|
|
11995
|
-
if (uri.search(/\.webp($|\?)/i) > 0 || uri.search(/^data\:image\/webp/) === 0)
|
|
11996
|
-
return "image/webp";
|
|
11703
|
+
if (uri.search(/\.jpe?g($|\?)/i) > 0 || uri.search(/^data\:image\/jpeg/) === 0) return "image/jpeg";
|
|
11704
|
+
if (uri.search(/\.webp($|\?)/i) > 0 || uri.search(/^data\:image\/webp/) === 0) return "image/webp";
|
|
11997
11705
|
return "image/png";
|
|
11998
11706
|
}
|
|
11999
11707
|
const _identityMatrix = new Matrix4();
|
|
@@ -12112,8 +11820,7 @@ class GLTFParser {
|
|
|
12112
11820
|
* Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
|
|
12113
11821
|
*/
|
|
12114
11822
|
_addNodeRef(cache, index) {
|
|
12115
|
-
if (index === void 0)
|
|
12116
|
-
return;
|
|
11823
|
+
if (index === void 0) return;
|
|
12117
11824
|
if (cache.refs[index] === void 0) {
|
|
12118
11825
|
cache.refs[index] = cache.uses[index] = 0;
|
|
12119
11826
|
}
|
|
@@ -12121,8 +11828,7 @@ class GLTFParser {
|
|
|
12121
11828
|
}
|
|
12122
11829
|
/** Returns a reference to a shared resource, cloning it if necessary. */
|
|
12123
11830
|
_getNodeRef(cache, index, object) {
|
|
12124
|
-
if (cache.refs[index] <= 1)
|
|
12125
|
-
return object;
|
|
11831
|
+
if (cache.refs[index] <= 1) return object;
|
|
12126
11832
|
const ref = object.clone();
|
|
12127
11833
|
const updateMappings = (original, clone) => {
|
|
12128
11834
|
const mappings = this.associations.get(original);
|
|
@@ -12142,8 +11848,7 @@ class GLTFParser {
|
|
|
12142
11848
|
extensions.push(this);
|
|
12143
11849
|
for (let i = 0; i < extensions.length; i++) {
|
|
12144
11850
|
const result = func(extensions[i]);
|
|
12145
|
-
if (result)
|
|
12146
|
-
return result;
|
|
11851
|
+
if (result) return result;
|
|
12147
11852
|
}
|
|
12148
11853
|
return null;
|
|
12149
11854
|
}
|
|
@@ -12153,8 +11858,7 @@ class GLTFParser {
|
|
|
12153
11858
|
const pending = [];
|
|
12154
11859
|
for (let i = 0; i < extensions.length; i++) {
|
|
12155
11860
|
const result = func(extensions[i]);
|
|
12156
|
-
if (result)
|
|
12157
|
-
pending.push(result);
|
|
11861
|
+
if (result) pending.push(result);
|
|
12158
11862
|
}
|
|
12159
11863
|
return pending;
|
|
12160
11864
|
}
|
|
@@ -12345,14 +12049,10 @@ class GLTFParser {
|
|
|
12345
12049
|
for (let i = 0, il = sparseIndices.length; i < il; i++) {
|
|
12346
12050
|
const index = sparseIndices[i];
|
|
12347
12051
|
bufferAttribute.setX(index, sparseValues[i * itemSize]);
|
|
12348
|
-
if (itemSize >= 2)
|
|
12349
|
-
|
|
12350
|
-
if (itemSize >= 3)
|
|
12351
|
-
|
|
12352
|
-
if (itemSize >= 4)
|
|
12353
|
-
bufferAttribute.setW(index, sparseValues[i * itemSize + 3]);
|
|
12354
|
-
if (itemSize >= 5)
|
|
12355
|
-
throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
12052
|
+
if (itemSize >= 2) bufferAttribute.setY(index, sparseValues[i * itemSize + 1]);
|
|
12053
|
+
if (itemSize >= 3) bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]);
|
|
12054
|
+
if (itemSize >= 4) bufferAttribute.setW(index, sparseValues[i * itemSize + 3]);
|
|
12055
|
+
if (itemSize >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
12356
12056
|
}
|
|
12357
12057
|
}
|
|
12358
12058
|
return bufferAttribute;
|
|
@@ -12372,8 +12072,7 @@ class GLTFParser {
|
|
|
12372
12072
|
let loader = this.textureLoader;
|
|
12373
12073
|
if (sourceDef.uri) {
|
|
12374
12074
|
const handler = options.manager.getHandler(sourceDef.uri);
|
|
12375
|
-
if (handler !== null)
|
|
12376
|
-
loader = handler;
|
|
12075
|
+
if (handler !== null) loader = handler;
|
|
12377
12076
|
}
|
|
12378
12077
|
return this.loadTextureImage(textureIndex, sourceIndex, loader);
|
|
12379
12078
|
}
|
|
@@ -12462,8 +12161,7 @@ class GLTFParser {
|
|
|
12462
12161
|
assignTexture(materialParams, mapName, mapDef, colorSpace) {
|
|
12463
12162
|
const parser = this;
|
|
12464
12163
|
return this.getDependency("texture", mapDef.index).then(function(texture) {
|
|
12465
|
-
if (!texture)
|
|
12466
|
-
return null;
|
|
12164
|
+
if (!texture) return null;
|
|
12467
12165
|
if (mapDef.texCoord !== void 0 && mapDef.texCoord > 0) {
|
|
12468
12166
|
texture = texture.clone();
|
|
12469
12167
|
texture.channel = mapDef.texCoord;
|
|
@@ -12523,24 +12221,17 @@ class GLTFParser {
|
|
|
12523
12221
|
}
|
|
12524
12222
|
if (useDerivativeTangents || useVertexColors || useFlatShading) {
|
|
12525
12223
|
let cacheKey = "ClonedMaterial:" + material.uuid + ":";
|
|
12526
|
-
if (useDerivativeTangents)
|
|
12527
|
-
|
|
12528
|
-
if (
|
|
12529
|
-
cacheKey += "vertex-colors:";
|
|
12530
|
-
if (useFlatShading)
|
|
12531
|
-
cacheKey += "flat-shading:";
|
|
12224
|
+
if (useDerivativeTangents) cacheKey += "derivative-tangents:";
|
|
12225
|
+
if (useVertexColors) cacheKey += "vertex-colors:";
|
|
12226
|
+
if (useFlatShading) cacheKey += "flat-shading:";
|
|
12532
12227
|
let cachedMaterial = this.cache.get(cacheKey);
|
|
12533
12228
|
if (!cachedMaterial) {
|
|
12534
12229
|
cachedMaterial = material.clone();
|
|
12535
|
-
if (useVertexColors)
|
|
12536
|
-
|
|
12537
|
-
if (useFlatShading)
|
|
12538
|
-
cachedMaterial.flatShading = true;
|
|
12230
|
+
if (useVertexColors) cachedMaterial.vertexColors = true;
|
|
12231
|
+
if (useFlatShading) cachedMaterial.flatShading = true;
|
|
12539
12232
|
if (useDerivativeTangents) {
|
|
12540
|
-
if (cachedMaterial.normalScale)
|
|
12541
|
-
|
|
12542
|
-
if (cachedMaterial.clearcoatNormalScale)
|
|
12543
|
-
cachedMaterial.clearcoatNormalScale.y *= -1;
|
|
12233
|
+
if (cachedMaterial.normalScale) cachedMaterial.normalScale.y *= -1;
|
|
12234
|
+
if (cachedMaterial.clearcoatNormalScale) cachedMaterial.clearcoatNormalScale.y *= -1;
|
|
12544
12235
|
}
|
|
12545
12236
|
this.cache.add(cacheKey, cachedMaterial);
|
|
12546
12237
|
this.associations.set(cachedMaterial, this.associations.get(material));
|
|
@@ -12630,12 +12321,10 @@ class GLTFParser {
|
|
|
12630
12321
|
}
|
|
12631
12322
|
return Promise.all(pending).then(function() {
|
|
12632
12323
|
const material = new materialType(materialParams);
|
|
12633
|
-
if (materialDef.name)
|
|
12634
|
-
material.name = materialDef.name;
|
|
12324
|
+
if (materialDef.name) material.name = materialDef.name;
|
|
12635
12325
|
assignExtrasToUserData(material, materialDef);
|
|
12636
12326
|
parser.associations.set(material, { materials: materialIndex });
|
|
12637
|
-
if (materialDef.extensions)
|
|
12638
|
-
addUnknownExtensionsToUserData(extensions, material, materialDef);
|
|
12327
|
+
if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef);
|
|
12639
12328
|
return material;
|
|
12640
12329
|
});
|
|
12641
12330
|
}
|
|
@@ -12738,8 +12427,7 @@ class GLTFParser {
|
|
|
12738
12427
|
}
|
|
12739
12428
|
mesh.name = parser.createUniqueName(meshDef.name || "mesh_" + meshIndex);
|
|
12740
12429
|
assignExtrasToUserData(mesh, meshDef);
|
|
12741
|
-
if (primitive.extensions)
|
|
12742
|
-
addUnknownExtensionsToUserData(extensions, mesh, primitive);
|
|
12430
|
+
if (primitive.extensions) addUnknownExtensionsToUserData(extensions, mesh, primitive);
|
|
12743
12431
|
parser.assignFinalMaterial(mesh);
|
|
12744
12432
|
meshes.push(mesh);
|
|
12745
12433
|
}
|
|
@@ -12750,13 +12438,11 @@ class GLTFParser {
|
|
|
12750
12438
|
});
|
|
12751
12439
|
}
|
|
12752
12440
|
if (meshes.length === 1) {
|
|
12753
|
-
if (meshDef.extensions)
|
|
12754
|
-
addUnknownExtensionsToUserData(extensions, meshes[0], meshDef);
|
|
12441
|
+
if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, meshes[0], meshDef);
|
|
12755
12442
|
return meshes[0];
|
|
12756
12443
|
}
|
|
12757
12444
|
const group = new Group();
|
|
12758
|
-
if (meshDef.extensions)
|
|
12759
|
-
addUnknownExtensionsToUserData(extensions, group, meshDef);
|
|
12445
|
+
if (meshDef.extensions) addUnknownExtensionsToUserData(extensions, group, meshDef);
|
|
12760
12446
|
parser.associations.set(group, { meshes: meshIndex });
|
|
12761
12447
|
for (let i = 0, il = meshes.length; i < il; i++) {
|
|
12762
12448
|
group.add(meshes[i]);
|
|
@@ -12782,8 +12468,7 @@ class GLTFParser {
|
|
|
12782
12468
|
} else if (cameraDef.type === "orthographic") {
|
|
12783
12469
|
camera = new OrthographicCamera(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar);
|
|
12784
12470
|
}
|
|
12785
|
-
if (cameraDef.name)
|
|
12786
|
-
camera.name = this.createUniqueName(cameraDef.name);
|
|
12471
|
+
if (cameraDef.name) camera.name = this.createUniqueName(cameraDef.name);
|
|
12787
12472
|
assignExtrasToUserData(camera, cameraDef);
|
|
12788
12473
|
return Promise.resolve(camera);
|
|
12789
12474
|
}
|
|
@@ -12846,8 +12531,7 @@ class GLTFParser {
|
|
|
12846
12531
|
const name = target.node;
|
|
12847
12532
|
const input = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.input] : sampler.input;
|
|
12848
12533
|
const output = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.output] : sampler.output;
|
|
12849
|
-
if (target.node === void 0)
|
|
12850
|
-
continue;
|
|
12534
|
+
if (target.node === void 0) continue;
|
|
12851
12535
|
pendingNodes.push(this.getDependency("node", name));
|
|
12852
12536
|
pendingInputAccessors.push(this.getDependency("accessor", input));
|
|
12853
12537
|
pendingOutputAccessors.push(this.getDependency("accessor", output));
|
|
@@ -12873,8 +12557,7 @@ class GLTFParser {
|
|
|
12873
12557
|
const outputAccessor = outputAccessors[i];
|
|
12874
12558
|
const sampler = samplers[i];
|
|
12875
12559
|
const target = targets[i];
|
|
12876
|
-
if (node === void 0)
|
|
12877
|
-
continue;
|
|
12560
|
+
if (node === void 0) continue;
|
|
12878
12561
|
if (node.updateMatrix) {
|
|
12879
12562
|
node.updateMatrix();
|
|
12880
12563
|
node.matrixAutoUpdate = true;
|
|
@@ -12893,14 +12576,12 @@ class GLTFParser {
|
|
|
12893
12576
|
const json = this.json;
|
|
12894
12577
|
const parser = this;
|
|
12895
12578
|
const nodeDef = json.nodes[nodeIndex];
|
|
12896
|
-
if (nodeDef.mesh === void 0)
|
|
12897
|
-
return null;
|
|
12579
|
+
if (nodeDef.mesh === void 0) return null;
|
|
12898
12580
|
return parser.getDependency("mesh", nodeDef.mesh).then(function(mesh) {
|
|
12899
12581
|
const node = parser._getNodeRef(parser.meshCache, nodeDef.mesh, mesh);
|
|
12900
12582
|
if (nodeDef.weights !== void 0) {
|
|
12901
12583
|
node.traverse(function(o) {
|
|
12902
|
-
if (!o.isMesh)
|
|
12903
|
-
return;
|
|
12584
|
+
if (!o.isMesh) return;
|
|
12904
12585
|
for (let i = 0, il = nodeDef.weights.length; i < il; i++) {
|
|
12905
12586
|
o.morphTargetInfluences[i] = nodeDef.weights[i];
|
|
12906
12587
|
}
|
|
@@ -12935,8 +12616,7 @@ class GLTFParser {
|
|
|
12935
12616
|
const skeleton = results[2];
|
|
12936
12617
|
if (skeleton !== null) {
|
|
12937
12618
|
node.traverse(function(mesh) {
|
|
12938
|
-
if (!mesh.isSkinnedMesh)
|
|
12939
|
-
return;
|
|
12619
|
+
if (!mesh.isSkinnedMesh) return;
|
|
12940
12620
|
mesh.bind(skeleton, _identityMatrix);
|
|
12941
12621
|
});
|
|
12942
12622
|
}
|
|
@@ -12995,8 +12675,7 @@ class GLTFParser {
|
|
|
12995
12675
|
node.name = nodeName;
|
|
12996
12676
|
}
|
|
12997
12677
|
assignExtrasToUserData(node, nodeDef);
|
|
12998
|
-
if (nodeDef.extensions)
|
|
12999
|
-
addUnknownExtensionsToUserData(extensions, node, nodeDef);
|
|
12678
|
+
if (nodeDef.extensions) addUnknownExtensionsToUserData(extensions, node, nodeDef);
|
|
13000
12679
|
if (nodeDef.matrix !== void 0) {
|
|
13001
12680
|
const matrix = new Matrix4();
|
|
13002
12681
|
matrix.fromArray(nodeDef.matrix);
|
|
@@ -13030,11 +12709,9 @@ class GLTFParser {
|
|
|
13030
12709
|
const sceneDef = this.json.scenes[sceneIndex];
|
|
13031
12710
|
const parser = this;
|
|
13032
12711
|
const scene = new Group();
|
|
13033
|
-
if (sceneDef.name)
|
|
13034
|
-
scene.name = parser.createUniqueName(sceneDef.name);
|
|
12712
|
+
if (sceneDef.name) scene.name = parser.createUniqueName(sceneDef.name);
|
|
13035
12713
|
assignExtrasToUserData(scene, sceneDef);
|
|
13036
|
-
if (sceneDef.extensions)
|
|
13037
|
-
addUnknownExtensionsToUserData(extensions, scene, sceneDef);
|
|
12714
|
+
if (sceneDef.extensions) addUnknownExtensionsToUserData(extensions, scene, sceneDef);
|
|
13038
12715
|
const nodeIds = sceneDef.nodes || [];
|
|
13039
12716
|
const pending = [];
|
|
13040
12717
|
for (let i = 0, il = nodeIds.length; i < il; i++) {
|
|
@@ -13200,8 +12877,7 @@ function addPrimitiveAttributes(geometry, primitiveDef, parser) {
|
|
|
13200
12877
|
}
|
|
13201
12878
|
for (const gltfAttributeName in attributes) {
|
|
13202
12879
|
const threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase();
|
|
13203
|
-
if (threeAttributeName in geometry.attributes)
|
|
13204
|
-
continue;
|
|
12880
|
+
if (threeAttributeName in geometry.attributes) continue;
|
|
13205
12881
|
pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName));
|
|
13206
12882
|
}
|
|
13207
12883
|
if (primitiveDef.indices !== void 0 && !geometry.index) {
|
|
@@ -13328,8 +13004,7 @@ class DRACOLoader extends Loader {
|
|
|
13328
13004
|
return geometry;
|
|
13329
13005
|
}
|
|
13330
13006
|
_assignVertexColorSpace(attribute, inputColorSpace) {
|
|
13331
|
-
if (inputColorSpace !== SRGBColorSpace)
|
|
13332
|
-
return;
|
|
13007
|
+
if (inputColorSpace !== SRGBColorSpace) return;
|
|
13333
13008
|
const _color2 = new Color();
|
|
13334
13009
|
for (let i = 0, il = attribute.count; i < il; i++) {
|
|
13335
13010
|
_color2.fromBufferAttribute(attribute, i).convertSRGBToLinear();
|
|
@@ -13350,8 +13025,7 @@ class DRACOLoader extends Loader {
|
|
|
13350
13025
|
return this;
|
|
13351
13026
|
}
|
|
13352
13027
|
_initDecoder() {
|
|
13353
|
-
if (this.decoderPending)
|
|
13354
|
-
return this.decoderPending;
|
|
13028
|
+
if (this.decoderPending) return this.decoderPending;
|
|
13355
13029
|
const useJS = typeof WebAssembly !== "object" || this.decoderConfig.type === "js";
|
|
13356
13030
|
const librariesPending = [];
|
|
13357
13031
|
if (useJS) {
|
|
@@ -13453,8 +13127,7 @@ function DRACOWorker() {
|
|
|
13453
13127
|
try {
|
|
13454
13128
|
const geometry = decodeGeometry(draco, decoder, new Int8Array(buffer), taskConfig);
|
|
13455
13129
|
const buffers = geometry.attributes.map((attr) => attr.array.buffer);
|
|
13456
|
-
if (geometry.index)
|
|
13457
|
-
buffers.push(geometry.index.array.buffer);
|
|
13130
|
+
if (geometry.index) buffers.push(geometry.index.array.buffer);
|
|
13458
13131
|
self.postMessage({ type: "decode", id: message.id, geometry }, buffers);
|
|
13459
13132
|
} catch (error) {
|
|
13460
13133
|
console.error(error);
|
|
@@ -13494,8 +13167,7 @@ function DRACOWorker() {
|
|
|
13494
13167
|
attribute = decoder.GetAttributeByUniqueId(dracoGeometry, attributeID);
|
|
13495
13168
|
} else {
|
|
13496
13169
|
attributeID = decoder.GetAttributeId(dracoGeometry, draco[attributeIDs[attributeName]]);
|
|
13497
|
-
if (attributeID === -1)
|
|
13498
|
-
continue;
|
|
13170
|
+
if (attributeID === -1) continue;
|
|
13499
13171
|
attribute = decoder.GetAttribute(dracoGeometry, attributeID);
|
|
13500
13172
|
}
|
|
13501
13173
|
const attributeResult = decodeAttribute(draco, decoder, dracoGeometry, attributeName, attributeType, attribute);
|