@antv/g-webgpu 1.1.5 → 1.1.8-alpha.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/WebGLContextService.d.ts +3 -4
- package/dist/WebGLContextService.d.ts.map +1 -1
- package/dist/index.esm.js +429 -30
- package/dist/index.js +428 -29
- package/dist/index.umd.js +554 -124
- package/dist/index.umd.min.js +7 -5
- package/package.json +6 -6
package/dist/index.umd.js
CHANGED
|
@@ -4,6 +4,387 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.G = global.G || {}, global.G.WebGPU = {}), global.window.G, global.window.G.ManaSyringe));
|
|
5
5
|
}(this, (function (exports, g, manaSyringe) { 'use strict';
|
|
6
6
|
|
|
7
|
+
function _regeneratorRuntime() {
|
|
8
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
9
|
+
|
|
10
|
+
_regeneratorRuntime = function () {
|
|
11
|
+
return exports;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var exports = {},
|
|
15
|
+
Op = Object.prototype,
|
|
16
|
+
hasOwn = Op.hasOwnProperty,
|
|
17
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
18
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
19
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
20
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
21
|
+
|
|
22
|
+
function define(obj, key, value) {
|
|
23
|
+
return Object.defineProperty(obj, key, {
|
|
24
|
+
value: value,
|
|
25
|
+
enumerable: !0,
|
|
26
|
+
configurable: !0,
|
|
27
|
+
writable: !0
|
|
28
|
+
}), obj[key];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
define({}, "");
|
|
33
|
+
} catch (err) {
|
|
34
|
+
define = function (obj, key, value) {
|
|
35
|
+
return obj[key] = value;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
40
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
41
|
+
generator = Object.create(protoGenerator.prototype),
|
|
42
|
+
context = new Context(tryLocsList || []);
|
|
43
|
+
return generator._invoke = function (innerFn, self, context) {
|
|
44
|
+
var state = "suspendedStart";
|
|
45
|
+
return function (method, arg) {
|
|
46
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
47
|
+
|
|
48
|
+
if ("completed" === state) {
|
|
49
|
+
if ("throw" === method) throw arg;
|
|
50
|
+
return doneResult();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
for (context.method = method, context.arg = arg;;) {
|
|
54
|
+
var delegate = context.delegate;
|
|
55
|
+
|
|
56
|
+
if (delegate) {
|
|
57
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
58
|
+
|
|
59
|
+
if (delegateResult) {
|
|
60
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
61
|
+
return delegateResult;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
66
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
67
|
+
context.dispatchException(context.arg);
|
|
68
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
69
|
+
state = "executing";
|
|
70
|
+
var record = tryCatch(innerFn, self, context);
|
|
71
|
+
|
|
72
|
+
if ("normal" === record.type) {
|
|
73
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
74
|
+
return {
|
|
75
|
+
value: record.arg,
|
|
76
|
+
done: context.done
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}(innerFn, self, context), generator;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function tryCatch(fn, obj, arg) {
|
|
87
|
+
try {
|
|
88
|
+
return {
|
|
89
|
+
type: "normal",
|
|
90
|
+
arg: fn.call(obj, arg)
|
|
91
|
+
};
|
|
92
|
+
} catch (err) {
|
|
93
|
+
return {
|
|
94
|
+
type: "throw",
|
|
95
|
+
arg: err
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
exports.wrap = wrap;
|
|
101
|
+
var ContinueSentinel = {};
|
|
102
|
+
|
|
103
|
+
function Generator() {}
|
|
104
|
+
|
|
105
|
+
function GeneratorFunction() {}
|
|
106
|
+
|
|
107
|
+
function GeneratorFunctionPrototype() {}
|
|
108
|
+
|
|
109
|
+
var IteratorPrototype = {};
|
|
110
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
111
|
+
return this;
|
|
112
|
+
});
|
|
113
|
+
var getProto = Object.getPrototypeOf,
|
|
114
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
115
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
116
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
117
|
+
|
|
118
|
+
function defineIteratorMethods(prototype) {
|
|
119
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
120
|
+
define(prototype, method, function (arg) {
|
|
121
|
+
return this._invoke(method, arg);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
127
|
+
function invoke(method, arg, resolve, reject) {
|
|
128
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
129
|
+
|
|
130
|
+
if ("throw" !== record.type) {
|
|
131
|
+
var result = record.arg,
|
|
132
|
+
value = result.value;
|
|
133
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
134
|
+
invoke("next", value, resolve, reject);
|
|
135
|
+
}, function (err) {
|
|
136
|
+
invoke("throw", err, resolve, reject);
|
|
137
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
138
|
+
result.value = unwrapped, resolve(result);
|
|
139
|
+
}, function (error) {
|
|
140
|
+
return invoke("throw", error, resolve, reject);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
reject(record.arg);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
var previousPromise;
|
|
148
|
+
|
|
149
|
+
this._invoke = function (method, arg) {
|
|
150
|
+
function callInvokeWithMethodAndArg() {
|
|
151
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
152
|
+
invoke(method, arg, resolve, reject);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
161
|
+
var method = delegate.iterator[context.method];
|
|
162
|
+
|
|
163
|
+
if (undefined === method) {
|
|
164
|
+
if (context.delegate = null, "throw" === context.method) {
|
|
165
|
+
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
166
|
+
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return ContinueSentinel;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
173
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
174
|
+
var info = record.arg;
|
|
175
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function pushTryEntry(locs) {
|
|
179
|
+
var entry = {
|
|
180
|
+
tryLoc: locs[0]
|
|
181
|
+
};
|
|
182
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function resetTryEntry(entry) {
|
|
186
|
+
var record = entry.completion || {};
|
|
187
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function Context(tryLocsList) {
|
|
191
|
+
this.tryEntries = [{
|
|
192
|
+
tryLoc: "root"
|
|
193
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function values(iterable) {
|
|
197
|
+
if (iterable) {
|
|
198
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
199
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
200
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
201
|
+
|
|
202
|
+
if (!isNaN(iterable.length)) {
|
|
203
|
+
var i = -1,
|
|
204
|
+
next = function next() {
|
|
205
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
206
|
+
|
|
207
|
+
return next.value = undefined, next.done = !0, next;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
return next.next = next;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
next: doneResult
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function doneResult() {
|
|
220
|
+
return {
|
|
221
|
+
value: undefined,
|
|
222
|
+
done: !0
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
227
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
228
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
229
|
+
}, exports.mark = function (genFun) {
|
|
230
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
231
|
+
}, exports.awrap = function (arg) {
|
|
232
|
+
return {
|
|
233
|
+
__await: arg
|
|
234
|
+
};
|
|
235
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
236
|
+
return this;
|
|
237
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
238
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
239
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
240
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
241
|
+
return result.done ? result.value : iter.next();
|
|
242
|
+
});
|
|
243
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
244
|
+
return this;
|
|
245
|
+
}), define(Gp, "toString", function () {
|
|
246
|
+
return "[object Generator]";
|
|
247
|
+
}), exports.keys = function (object) {
|
|
248
|
+
var keys = [];
|
|
249
|
+
|
|
250
|
+
for (var key in object) keys.push(key);
|
|
251
|
+
|
|
252
|
+
return keys.reverse(), function next() {
|
|
253
|
+
for (; keys.length;) {
|
|
254
|
+
var key = keys.pop();
|
|
255
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return next.done = !0, next;
|
|
259
|
+
};
|
|
260
|
+
}, exports.values = values, Context.prototype = {
|
|
261
|
+
constructor: Context,
|
|
262
|
+
reset: function (skipTempReset) {
|
|
263
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
264
|
+
},
|
|
265
|
+
stop: function () {
|
|
266
|
+
this.done = !0;
|
|
267
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
268
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
269
|
+
return this.rval;
|
|
270
|
+
},
|
|
271
|
+
dispatchException: function (exception) {
|
|
272
|
+
if (this.done) throw exception;
|
|
273
|
+
var context = this;
|
|
274
|
+
|
|
275
|
+
function handle(loc, caught) {
|
|
276
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
280
|
+
var entry = this.tryEntries[i],
|
|
281
|
+
record = entry.completion;
|
|
282
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
283
|
+
|
|
284
|
+
if (entry.tryLoc <= this.prev) {
|
|
285
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
286
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
287
|
+
|
|
288
|
+
if (hasCatch && hasFinally) {
|
|
289
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
290
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
291
|
+
} else if (hasCatch) {
|
|
292
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
293
|
+
} else {
|
|
294
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
295
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
abrupt: function (type, arg) {
|
|
301
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
302
|
+
var entry = this.tryEntries[i];
|
|
303
|
+
|
|
304
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
305
|
+
var finallyEntry = entry;
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
311
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
312
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
313
|
+
},
|
|
314
|
+
complete: function (record, afterLoc) {
|
|
315
|
+
if ("throw" === record.type) throw record.arg;
|
|
316
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
317
|
+
},
|
|
318
|
+
finish: function (finallyLoc) {
|
|
319
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
320
|
+
var entry = this.tryEntries[i];
|
|
321
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
catch: function (tryLoc) {
|
|
325
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
326
|
+
var entry = this.tryEntries[i];
|
|
327
|
+
|
|
328
|
+
if (entry.tryLoc === tryLoc) {
|
|
329
|
+
var record = entry.completion;
|
|
330
|
+
|
|
331
|
+
if ("throw" === record.type) {
|
|
332
|
+
var thrown = record.arg;
|
|
333
|
+
resetTryEntry(entry);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return thrown;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
throw new Error("illegal catch attempt");
|
|
341
|
+
},
|
|
342
|
+
delegateYield: function (iterable, resultName, nextLoc) {
|
|
343
|
+
return this.delegate = {
|
|
344
|
+
iterator: values(iterable),
|
|
345
|
+
resultName: resultName,
|
|
346
|
+
nextLoc: nextLoc
|
|
347
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
348
|
+
}
|
|
349
|
+
}, exports;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
353
|
+
try {
|
|
354
|
+
var info = gen[key](arg);
|
|
355
|
+
var value = info.value;
|
|
356
|
+
} catch (error) {
|
|
357
|
+
reject(error);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (info.done) {
|
|
362
|
+
resolve(value);
|
|
363
|
+
} else {
|
|
364
|
+
Promise.resolve(value).then(_next, _throw);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function _asyncToGenerator(fn) {
|
|
369
|
+
return function () {
|
|
370
|
+
var self = this,
|
|
371
|
+
args = arguments;
|
|
372
|
+
return new Promise(function (resolve, reject) {
|
|
373
|
+
var gen = fn.apply(self, args);
|
|
374
|
+
|
|
375
|
+
function _next(value) {
|
|
376
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function _throw(err) {
|
|
380
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
_next(undefined);
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
7
388
|
function _inheritsLoose(subClass, superClass) {
|
|
8
389
|
subClass.prototype = Object.create(superClass.prototype);
|
|
9
390
|
subClass.prototype.constructor = subClass;
|
|
@@ -46,9 +427,9 @@
|
|
|
46
427
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
47
428
|
}
|
|
48
429
|
|
|
49
|
-
function _regeneratorRuntime() {
|
|
430
|
+
function _regeneratorRuntime$1() {
|
|
50
431
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
51
|
-
_regeneratorRuntime = function _regeneratorRuntime() {
|
|
432
|
+
_regeneratorRuntime$1 = function _regeneratorRuntime() {
|
|
52
433
|
return exports;
|
|
53
434
|
};
|
|
54
435
|
|
|
@@ -396,7 +777,7 @@
|
|
|
396
777
|
}, exports;
|
|
397
778
|
}
|
|
398
779
|
|
|
399
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
780
|
+
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
400
781
|
try {
|
|
401
782
|
var info = gen[key](arg);
|
|
402
783
|
var value = info.value;
|
|
@@ -412,7 +793,7 @@
|
|
|
412
793
|
}
|
|
413
794
|
}
|
|
414
795
|
|
|
415
|
-
function _asyncToGenerator(fn) {
|
|
796
|
+
function _asyncToGenerator$1(fn) {
|
|
416
797
|
return function () {
|
|
417
798
|
var self = this,
|
|
418
799
|
args = arguments;
|
|
@@ -420,11 +801,11 @@
|
|
|
420
801
|
var gen = fn.apply(self, args);
|
|
421
802
|
|
|
422
803
|
function _next(value) {
|
|
423
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
804
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
424
805
|
}
|
|
425
806
|
|
|
426
807
|
function _throw(err) {
|
|
427
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
808
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
428
809
|
}
|
|
429
810
|
|
|
430
811
|
_next(undefined);
|
|
@@ -525,9 +906,9 @@
|
|
|
525
906
|
globalThis.removeEventListener('mouseup', onPointerUp, true);
|
|
526
907
|
};
|
|
527
908
|
|
|
528
|
-
renderingService.hooks.init.tapPromise(DOMInteractionPlugin_1.tag, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
909
|
+
renderingService.hooks.init.tapPromise(DOMInteractionPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
|
|
529
910
|
var $el;
|
|
530
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
911
|
+
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
531
912
|
while (1) {
|
|
532
913
|
switch (_context.prev = _context.next) {
|
|
533
914
|
case 0:
|
|
@@ -2603,9 +2984,9 @@
|
|
|
2603
2984
|
|
|
2604
2985
|
PickingIdGenerator = __decorate([manaSyringe.singleton()], PickingIdGenerator);
|
|
2605
2986
|
|
|
2606
|
-
function _regeneratorRuntime$
|
|
2987
|
+
function _regeneratorRuntime$2() {
|
|
2607
2988
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
2608
|
-
_regeneratorRuntime$
|
|
2989
|
+
_regeneratorRuntime$2 = function _regeneratorRuntime() {
|
|
2609
2990
|
return exports;
|
|
2610
2991
|
};
|
|
2611
2992
|
|
|
@@ -2953,7 +3334,7 @@
|
|
|
2953
3334
|
}, exports;
|
|
2954
3335
|
}
|
|
2955
3336
|
|
|
2956
|
-
function asyncGeneratorStep$
|
|
3337
|
+
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2957
3338
|
try {
|
|
2958
3339
|
var info = gen[key](arg);
|
|
2959
3340
|
var value = info.value;
|
|
@@ -2969,7 +3350,7 @@
|
|
|
2969
3350
|
}
|
|
2970
3351
|
}
|
|
2971
3352
|
|
|
2972
|
-
function _asyncToGenerator$
|
|
3353
|
+
function _asyncToGenerator$2(fn) {
|
|
2973
3354
|
return function () {
|
|
2974
3355
|
var self = this,
|
|
2975
3356
|
args = arguments;
|
|
@@ -2977,11 +3358,11 @@
|
|
|
2977
3358
|
var gen = fn.apply(self, args);
|
|
2978
3359
|
|
|
2979
3360
|
function _next(value) {
|
|
2980
|
-
asyncGeneratorStep$
|
|
3361
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
2981
3362
|
}
|
|
2982
3363
|
|
|
2983
3364
|
function _throw(err) {
|
|
2984
|
-
asyncGeneratorStep$
|
|
3365
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2985
3366
|
}
|
|
2986
3367
|
|
|
2987
3368
|
_next(undefined);
|
|
@@ -5596,10 +5977,10 @@
|
|
|
5596
5977
|
return acc;
|
|
5597
5978
|
};
|
|
5598
5979
|
|
|
5599
|
-
_proto.values = /*#__PURE__*/_regeneratorRuntime$
|
|
5980
|
+
_proto.values = /*#__PURE__*/_regeneratorRuntime$2().mark(function values() {
|
|
5600
5981
|
var _iterator2, _step2, bucket, j;
|
|
5601
5982
|
|
|
5602
|
-
return _regeneratorRuntime$
|
|
5983
|
+
return _regeneratorRuntime$2().wrap(function values$(_context) {
|
|
5603
5984
|
while (1) {
|
|
5604
5985
|
switch (_context.prev = _context.next) {
|
|
5605
5986
|
case 0:
|
|
@@ -9091,12 +9472,6 @@
|
|
|
9091
9472
|
frontFace: frontFace,
|
|
9092
9473
|
polygonOffset: polygonOffset,
|
|
9093
9474
|
attachmentsState: attachmentsState,
|
|
9094
|
-
blendEquation: BlendMode.Add,
|
|
9095
|
-
blendEquationAlpha: BlendMode.Add,
|
|
9096
|
-
blendSrc: BlendFactor.SrcAlpha,
|
|
9097
|
-
blendDst: BlendFactor.OneMinusSrcAlpha,
|
|
9098
|
-
blendSrcAlpha: BlendFactor.Zero,
|
|
9099
|
-
blendDstAlpha: BlendFactor.One,
|
|
9100
9475
|
dithering: false,
|
|
9101
9476
|
wireframe: false,
|
|
9102
9477
|
wireframeColor: 'black',
|
|
@@ -9212,6 +9587,14 @@
|
|
|
9212
9587
|
* Blending state
|
|
9213
9588
|
*/
|
|
9214
9589
|
|
|
9590
|
+
}, {
|
|
9591
|
+
key: "blendConstant",
|
|
9592
|
+
get: function get() {
|
|
9593
|
+
return this.props.blendConstant;
|
|
9594
|
+
},
|
|
9595
|
+
set: function set(value) {
|
|
9596
|
+
this.props.blendConstant = value;
|
|
9597
|
+
}
|
|
9215
9598
|
}, {
|
|
9216
9599
|
key: "blendEquation",
|
|
9217
9600
|
get: function get() {
|
|
@@ -9441,6 +9824,14 @@
|
|
|
9441
9824
|
});
|
|
9442
9825
|
}
|
|
9443
9826
|
|
|
9827
|
+
var definedProps = function definedProps(obj) {
|
|
9828
|
+
return Object.fromEntries(Object.entries(obj).filter(function (_ref) {
|
|
9829
|
+
var k = _ref[0],
|
|
9830
|
+
v = _ref[1];
|
|
9831
|
+
return v !== undefined;
|
|
9832
|
+
}));
|
|
9833
|
+
};
|
|
9834
|
+
|
|
9444
9835
|
var counter$1 = 1;
|
|
9445
9836
|
var FILL_TEXTURE_MAPPING = 'FillTextureMapping';
|
|
9446
9837
|
/**
|
|
@@ -10181,29 +10572,15 @@
|
|
|
10181
10572
|
cullMode = material.cullMode,
|
|
10182
10573
|
frontFace = material.frontFace,
|
|
10183
10574
|
polygonOffset = material.polygonOffset,
|
|
10575
|
+
blendConstant = material.blendConstant,
|
|
10184
10576
|
blendEquation = material.blendEquation,
|
|
10185
10577
|
blendEquationAlpha = material.blendEquationAlpha,
|
|
10186
10578
|
blendSrc = material.blendSrc,
|
|
10187
10579
|
blendDst = material.blendDst,
|
|
10188
10580
|
blendSrcAlpha = material.blendSrcAlpha,
|
|
10189
10581
|
blendDstAlpha = material.blendDstAlpha;
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
// should not affect color buffer when drawing stencil
|
|
10193
|
-
channelWriteMask: this.material.stencilWrite ? ChannelWriteMask.None : ChannelWriteMask.AllChannels,
|
|
10194
|
-
// channelWriteMask: ChannelWriteMask.AllChannels,
|
|
10195
|
-
rgbBlendState: {
|
|
10196
|
-
blendMode: blendEquation,
|
|
10197
|
-
blendSrcFactor: blendSrc,
|
|
10198
|
-
blendDstFactor: blendDst
|
|
10199
|
-
},
|
|
10200
|
-
alphaBlendState: {
|
|
10201
|
-
blendMode: blendEquationAlpha,
|
|
10202
|
-
blendSrcFactor: blendSrcAlpha,
|
|
10203
|
-
blendDstFactor: blendDstAlpha
|
|
10204
|
-
}
|
|
10205
|
-
}],
|
|
10206
|
-
// blendConstant: Color;
|
|
10582
|
+
var materialMegaState = definedProps({
|
|
10583
|
+
blendConstant: blendConstant,
|
|
10207
10584
|
depthCompare: depthCompare,
|
|
10208
10585
|
depthWrite: depthWrite,
|
|
10209
10586
|
stencilCompare: stencilCompare,
|
|
@@ -10214,6 +10591,24 @@
|
|
|
10214
10591
|
frontFace: frontFace,
|
|
10215
10592
|
polygonOffset: polygonOffset
|
|
10216
10593
|
});
|
|
10594
|
+
var currentAttachmentsState = renderInst.getMegaStateFlags().attachmentsState[0];
|
|
10595
|
+
renderInst.setMegaStateFlags(_extends({
|
|
10596
|
+
attachmentsState: [{
|
|
10597
|
+
// should not affect color buffer when drawing stencil
|
|
10598
|
+
channelWriteMask: this.material.stencilWrite ? ChannelWriteMask.None : ChannelWriteMask.AllChannels,
|
|
10599
|
+
// channelWriteMask: ChannelWriteMask.AllChannels,
|
|
10600
|
+
rgbBlendState: _extends({}, currentAttachmentsState.rgbBlendState, definedProps({
|
|
10601
|
+
blendMode: blendEquation,
|
|
10602
|
+
blendSrcFactor: blendSrc,
|
|
10603
|
+
blendDstFactor: blendDst
|
|
10604
|
+
})),
|
|
10605
|
+
alphaBlendState: _extends({}, currentAttachmentsState.alphaBlendState, definedProps({
|
|
10606
|
+
blendMode: blendEquationAlpha,
|
|
10607
|
+
blendSrcFactor: blendSrcAlpha,
|
|
10608
|
+
blendDstFactor: blendDstAlpha
|
|
10609
|
+
}))
|
|
10610
|
+
}]
|
|
10611
|
+
}, materialMegaState));
|
|
10217
10612
|
renderInst.setBindingLayouts([{
|
|
10218
10613
|
numUniformBuffers: numUniformBuffers,
|
|
10219
10614
|
numSamplers: this.textureMappings.length,
|
|
@@ -10320,9 +10715,9 @@
|
|
|
10320
10715
|
__decorate([manaSyringe.inject(LightPool), __metadata("design:type", LightPool)], Instanced.prototype, "lightPool", void 0);
|
|
10321
10716
|
|
|
10322
10717
|
Instanced = __decorate([manaSyringe.injectable()], Instanced);
|
|
10323
|
-
var
|
|
10718
|
+
var frag = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nin vec4 v_Data;\nin vec2 v_Radius;\nin vec4 v_StylePacked3;\n\nout vec4 outputColor;\n\n/**\n * 2D signed distance field functions\n * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n */\n\nfloat sdCircle(vec2 p, float r) {\n return length(p) - r;\n}\n\n// @see http://www.iquilezles.org/www/articles/ellipsoids/ellipsoids.htm\nfloat sdEllipsoidApproximated(vec2 p, vec2 r) {\n float k0 = length(p / r);\n float k1 = length(p / (r * r));\n return k0 * (k0 - 1.0) / k1;\n}\n\nvoid main() {\n int shape = int(floor(v_Data.w + 0.5));\n float epsilon = 0.000001;\n\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n bool omitStroke = v_StylePacked3.z == 1.0;\n\n float antialiasblur = v_Data.z;\n float antialiased_blur = -max(0.0, antialiasblur);\n vec2 r = (v_Radius - (omitStroke ? 0.0 : u_StrokeWidth)) / v_Radius;\n\n float outer_df;\n float inner_df;\n // 'circle', 'ellipse', 'rect'\n if (shape == 0) {\n outer_df = sdCircle(v_Data.xy, 1.0);\n inner_df = sdCircle(v_Data.xy, r.x);\n } else if (shape == 1) {\n outer_df = sdEllipsoidApproximated(v_Data.xy, vec2(1.0));\n inner_df = sdEllipsoidApproximated(v_Data.xy, r);\n }\n\n float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);\n\n float color_t = u_StrokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n inner_df\n );\n\n // vec2 imagecoord = mod(v_Uv, 0.1);\n // vec4 texel = texture(SAMPLER_2D(u_Map), imagecoord);\n // u_Color = texel;\n\n vec4 diffuseColor;\n vec4 strokeColor;\n if (u_IsPicking > 0.5) {\n diffuseColor = vec4(u_PickingColor, 1.0);\n strokeColor = vec4(u_PickingColor, 1.0);\n } else {\n diffuseColor = u_Color;\n strokeColor = (u_StrokeColor == vec4(0) || omitStroke) ? vec4(0.0) : u_StrokeColor;\n }\n\n outputColor = mix(vec4(diffuseColor.rgb, diffuseColor.a * u_FillOpacity), strokeColor * u_StrokeOpacity, color_t);\n outputColor.a = outputColor.a * u_Opacity * opacity_t;\n\n if (outputColor.a < epsilon)\n discard;\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n }\n}"; // eslint-disable-line
|
|
10324
10719
|
|
|
10325
|
-
var
|
|
10720
|
+
var vert = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec2 a_Extrude;\nlayout(location = PACKED_STYLE3) in vec4 a_StylePacked3;\nlayout(location = SIZE) in vec2 a_Size;\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nout vec4 v_Data;\nout vec2 v_Radius;\nout vec4 v_StylePacked3;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n float strokeWidth;\n if (u_IsPicking > 0.5) {\n strokeWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n strokeWidth = u_StrokeWidth;\n }\n\n float antialiasblur = 1.0 / (a_Size.x + strokeWidth);\n\n bool omitStroke = a_StylePacked3.z == 1.0;\n vec2 radius = a_Size + vec2(omitStroke ? 0.0 : strokeWidth / 2.0);\n vec2 offset = (a_Extrude + vec2(1.0) - 2.0 * u_Anchor.xy) * radius;\n\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n \n v_Radius = radius;\n v_Data = vec4(a_Extrude, antialiasblur, a_StylePacked3.x);\n v_StylePacked3 = a_StylePacked3;\n}"; // eslint-disable-line
|
|
10326
10721
|
|
|
10327
10722
|
var SDFVertexAttributeBufferIndex;
|
|
10328
10723
|
|
|
@@ -10359,7 +10754,7 @@
|
|
|
10359
10754
|
return false;
|
|
10360
10755
|
}
|
|
10361
10756
|
|
|
10362
|
-
if (this.needDrawStrokeSeparately(object) || this.needDrawStrokeSeparately(this.instance)) {
|
|
10757
|
+
if (this.needDrawStrokeSeparately(object.parsedStyle) || this.needDrawStrokeSeparately(this.instance.parsedStyle)) {
|
|
10363
10758
|
return false;
|
|
10364
10759
|
}
|
|
10365
10760
|
|
|
@@ -10478,24 +10873,29 @@
|
|
|
10478
10873
|
return size;
|
|
10479
10874
|
};
|
|
10480
10875
|
|
|
10481
|
-
_proto.shouldOmitStroke = function shouldOmitStroke(
|
|
10482
|
-
var lineDash =
|
|
10483
|
-
stroke =
|
|
10484
|
-
strokeOpacity =
|
|
10485
|
-
|
|
10876
|
+
_proto.shouldOmitStroke = function shouldOmitStroke(parsedStyle) {
|
|
10877
|
+
var lineDash = parsedStyle.lineDash,
|
|
10878
|
+
stroke = parsedStyle.stroke,
|
|
10879
|
+
strokeOpacity = parsedStyle.strokeOpacity;
|
|
10880
|
+
var hasStroke = stroke && !stroke.isNone;
|
|
10881
|
+
var hasLineDash = lineDash && lineDash.length && lineDash.every(function (item) {
|
|
10486
10882
|
return item.value !== 0;
|
|
10487
|
-
})
|
|
10883
|
+
});
|
|
10884
|
+
var hasStrokeOpacity = strokeOpacity.value < 1;
|
|
10885
|
+
return !hasStroke || hasStroke && (hasLineDash || hasStrokeOpacity);
|
|
10488
10886
|
};
|
|
10489
10887
|
|
|
10490
|
-
_proto.needDrawStrokeSeparately = function needDrawStrokeSeparately(
|
|
10491
|
-
var
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10888
|
+
_proto.needDrawStrokeSeparately = function needDrawStrokeSeparately(parsedStyle) {
|
|
10889
|
+
var stroke = parsedStyle.stroke,
|
|
10890
|
+
lineDash = parsedStyle.lineDash,
|
|
10891
|
+
lineWidth = parsedStyle.lineWidth,
|
|
10892
|
+
strokeOpacity = parsedStyle.strokeOpacity;
|
|
10893
|
+
var hasStroke = stroke && !stroke.isNone;
|
|
10894
|
+
var hasLineDash = lineDash && lineDash.length && lineDash.every(function (item) {
|
|
10497
10895
|
return item.value !== 0;
|
|
10498
|
-
})
|
|
10896
|
+
});
|
|
10897
|
+
var hasStrokeOpacity = strokeOpacity.value < 1;
|
|
10898
|
+
return hasStroke && lineWidth.value > 0 && (hasLineDash || hasStrokeOpacity);
|
|
10499
10899
|
};
|
|
10500
10900
|
|
|
10501
10901
|
return SDFMesh;
|
|
@@ -11107,10 +11507,10 @@
|
|
|
11107
11507
|
return piMod(Math.atan2(dy, dx));
|
|
11108
11508
|
}
|
|
11109
11509
|
};
|
|
11110
|
-
var vert$2 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_Color;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nlayout(location = PREV) in vec2 a_Prev;\nlayout(location = POINT1) in vec2 a_Point1;\nlayout(location = POINT2) in vec2 a_Point2;\nlayout(location = NEXT) in vec2 a_Next;\nlayout(location = VERTEX_JOINT) in float a_VertexJoint;\nlayout(location = VERTEX_NUM) in float a_VertexNum;\nlayout(location = TRAVEL) in float a_Travel;\n\nconst float FILL = 1.0;\nconst float BEVEL = 4.0;\nconst float MITER = 8.0;\nconst float ROUND = 12.0;\nconst float JOINT_CAP_BUTT = 16.0;\nconst float JOINT_CAP_SQUARE = 18.0;\nconst float JOINT_CAP_ROUND = 20.0;\nconst float FILL_EXPAND = 24.0;\nconst float CAP_BUTT = 1.0;\nconst float CAP_SQUARE = 2.0;\nconst float CAP_ROUND = 3.0;\nconst float CAP_BUTT2 = 4.0;\n\nout vec4 v_Distance;\nout vec4 v_Arc;\nout float v_Type;\nout float v_Travel;\n\nvec2 doBisect(\n vec2 norm, float len, vec2 norm2, float len2, float dy, float inner\n) {\n vec2 bisect = (norm + norm2) / 2.0;\n bisect /= dot(norm, bisect);\n vec2 shift = dy * bisect;\n if (inner > 0.5) {\n if (len < len2) {\n if (abs(dy * (bisect.x * norm.y - bisect.y * norm.x)) > len) {\n return dy * norm;\n }\n } else {\n if (abs(dy * (bisect.x * norm2.y - bisect.y * norm2.x)) > len2) {\n return dy * norm;\n }\n }\n }\n return dy * bisect;\n}\n\nvoid main() {\n vec2 pointA = (u_ModelMatrix * vec4(a_Point1, 0., 1.0)).xy;\n vec2 pointB = (u_ModelMatrix * vec4(a_Point2, 0., 1.0)).xy;\n\n vec2 xBasis = pointB - pointA;\n float len = length(xBasis);\n vec2 forward = xBasis / len;\n vec2 norm = vec2(forward.y, -forward.x);\n\n float type = a_VertexJoint;\n\n float lineWidth;\n if (u_IsPicking > 0.5) {\n lineWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n lineWidth = u_StrokeWidth;\n }\n\n if (u_ScaleMode > 2.5) {\n lineWidth *= length(u_ModelMatrix * vec4(1.0, 0.0, 0.0, 0.0));\n } else if (u_ScaleMode > 1.5) {\n lineWidth *= length(u_ModelMatrix * vec4(0.0, 1.0, 0.0, 0.0));\n } else if (u_ScaleMode > 0.5) {\n vec2 avgDiag = (u_ModelMatrix * vec4(1.0, 1.0, 0.0, 0.0)).xy;\n lineWidth *= sqrt(dot(avgDiag, avgDiag) * 0.5);\n }\n float capType = floor(type / 32.0);\n type -= capType * 32.0;\n v_Arc = vec4(0.0);\n lineWidth *= 0.5;\n float lineAlignment = 2.0 * u_Alignment - 1.0;\n\n vec2 pos;\n\n if (capType == CAP_ROUND) {\n if (a_VertexNum < 3.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n type = JOINT_CAP_ROUND;\n capType = 0.0;\n }\n\n if (type >= BEVEL) {\n float dy = lineWidth + u_Expand;\n float inner = 0.0;\n if (a_VertexNum >= 1.5) {\n dy = -dy;\n inner = 1.0;\n }\n\n vec2 base, next, xBasis2, bisect;\n float flag = 0.0;\n float sign2 = 1.0;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5 && a_VertexNum < 3.5) {\n next = (u_ModelMatrix * vec4(a_Prev, 0.0, 1.0)).xy;\n base = pointA;\n flag = type - floor(type / 2.0) * 2.0;\n sign2 = -1.0;\n\n } else {\n next = (u_ModelMatrix * vec4(a_Next, 0.0, 1.0)).xy;\n base = pointB;\n if (type >= MITER && type < MITER + 3.5) {\n flag = step(MITER + 1.5, type);\n // check miter limit here?\n }\n }\n xBasis2 = next - base;\n float len2 = length(xBasis2);\n vec2 norm2 = vec2(xBasis2.y, -xBasis2.x) / len2;\n float D = norm.x * norm2.y - norm.y * norm2.x;\n if (D < 0.0) {\n inner = 1.0 - inner;\n }\n norm2 *= sign2;\n\n if (abs(lineAlignment) > 0.01) {\n float shift = lineWidth * lineAlignment;\n pointA += norm * shift;\n pointB += norm * shift;\n if (abs(D) < 0.01) {\n base += norm * shift;\n } else {\n base += doBisect(norm, len, norm2, len2, shift, 0.0);\n }\n }\n\n float collinear = step(0.0, dot(norm, norm2));\n v_Type = 0.0;\n float dy2 = -1000.0;\n float dy3 = -1000.0;\n if (abs(D) < 0.01 && collinear < 0.5) {\n if (type >= ROUND && type < ROUND + 1.5) {\n type = JOINT_CAP_ROUND;\n }\n //TODO: BUTT here too\n }\n\n if (a_VertexNum < 3.5) {\n if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (flag < 0.5 && inner < 0.5) {\n pos = dy * norm;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, inner);\n }\n }\n if (capType >= CAP_BUTT && capType < CAP_ROUND) {\n float extra = step(CAP_SQUARE, capType) * lineWidth;\n vec2 back = -forward;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n pos += back * (u_Expand + extra);\n dy2 = u_Expand;\n } else {\n dy2 = dot(pos + base - pointA, back) - extra;\n }\n }\n if (type >= JOINT_CAP_BUTT && type < JOINT_CAP_SQUARE + 0.5) {\n float extra = step(JOINT_CAP_SQUARE, type) * lineWidth;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n dy3 = dot(pos + base - pointB, forward) - extra;\n } else {\n pos += forward * (u_Expand + extra);\n dy3 = u_Expand;\n if (capType >= CAP_BUTT) {\n dy2 -= u_Expand + extra;\n }\n }\n }\n } else if (type >= JOINT_CAP_ROUND && type < JOINT_CAP_ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n vec2 d2 = abs(dy) * forward;\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = dy * norm;\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum < 6.5) {\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n } else {\n dy = -dy;\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n }\n dy2 = 0.0;\n v_Arc.y = dy;\n v_Arc.z = 0.0;\n v_Arc.w = lineWidth;\n v_Type = 3.0;\n } else if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (type >= ROUND && type < ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n float d2 = abs(dy);\n if (length(pos) > abs(dy) * 1.5) {\n if (a_VertexNum < 6.5) {\n pos.x = dy * norm.x - d2 * norm.y;\n pos.y = dy * norm.y + d2 * norm.x;\n } else {\n pos.x = dy * norm2.x + d2 * norm2.y;\n pos.y = dy * norm2.y - d2 * norm2.x;\n }\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n v_Arc.x = sign * dot(pos, norm3);\n v_Arc.y = pos.x * norm3.y - pos.y * norm3.x;\n v_Arc.z = dot(norm, norm3) * lineWidth;\n v_Arc.w = lineWidth;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = v_Arc.z - v_Arc.x;\n v_Type = 3.0;\n } else {\n float hit = 0.0;\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (dot(norm, norm2) > 0.0) {\n type = MITER;\n }\n }\n if (type >= MITER && type < MITER + 3.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float sign = step(0.0, dy) * 2.0 - 1.0;\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n if (length(pos) > abs(dy) * u_MiterLimit) {\n type = BEVEL;\n } else {\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = doBisect(norm, len, norm2, len2, dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 6.5) {\n pos = dy * norm2;\n }\n v_Type = 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n hit = 1.0;\n }\n }\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float d2 = abs(dy);\n vec2 pos3 = vec2(dy * norm.x - d2 * norm.y, dy * norm.y + d2 * norm.x);\n vec2 pos4 = vec2(dy * norm2.x + d2 * norm2.y, dy * norm2.y - d2 * norm2.x);\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n if (a_VertexNum < 6.5) {\n pos = pos3;\n } else {\n pos = pos4;\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = (-sign * dot(pos, norm3)) + lineWidth;\n v_Type = 4.0;\n hit = 1.0;\n }\n if (hit < 0.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n }\n }\n pos += base;\n v_Distance = vec4(dy, dy2, dy3, lineWidth) * u_DevicePixelRatio;\n v_Arc = v_Arc * u_DevicePixelRatio;\n v_Travel = a_Travel + dot(pos - pointA, vec2(-norm.y, norm.x));\n }\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * vec4(pos, u_ZIndex, 1.0);\n}"; // eslint-disable-line
|
|
11111
|
-
|
|
11112
11510
|
var frag$2 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_Color;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nin vec4 v_Distance;\nin vec4 v_Arc;\nin float v_Type;\nin float v_Travel;\n\nout vec4 outputColor;\n\n#define COLOR_SCALE 1. / 255.\n\nvoid main(){\n if (u_Visible < 0.5) {\n discard;\n }\n\n float alpha = 1.0;\n float lineWidth = v_Distance.w;\n if (v_Type < 0.5) {\n float left = max(v_Distance.x - 0.5, -v_Distance.w);\n float right = min(v_Distance.x + 0.5, v_Distance.w);\n float near = v_Distance.y - 0.5;\n float far = min(v_Distance.y + 0.5, 0.0);\n float top = v_Distance.z - 0.5;\n float bottom = min(v_Distance.z + 0.5, 0.0);\n alpha = max(right - left, 0.0) * max(bottom - top, 0.0) * max(far - near, 0.0);\n } else if (v_Type < 1.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n } else if (v_Type < 2.5) {\n alpha *= max(min(v_Distance.x + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.y + 0.5, 1.0), 0.0);\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n } else if (v_Type < 3.5) {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n float alpha_miter = a2 * b2 - a1 * b1;\n float alpha_plane = max(min(v_Distance.z + 0.5, 1.0), 0.0);\n float d = length(v_Arc.xy);\n float circle_hor = max(min(v_Arc.w, d + 0.5) - max(-v_Arc.w, d - 0.5), 0.0);\n float circle_vert = min(v_Arc.w * 2.0, 1.0);\n float alpha_circle = circle_hor * circle_vert;\n alpha = min(alpha_miter, max(alpha_circle, alpha_plane));\n } else {\n float a1 = clamp(v_Distance.x + 0.5 - lineWidth, 0.0, 1.0);\n float a2 = clamp(v_Distance.x + 0.5 + lineWidth, 0.0, 1.0);\n float b1 = clamp(v_Distance.y + 0.5 - lineWidth, 0.0, 1.0);\n float b2 = clamp(v_Distance.y + 0.5 + lineWidth, 0.0, 1.0);\n alpha = a2 * b2 - a1 * b1;\n alpha *= max(min(v_Distance.z + 0.5, 1.0), 0.0);\n }\n\n if (u_Dash + u_Gap > 1.0) {\n float travel = mod(v_Travel + u_Gap * 0.5 + u_DashOffset, u_Dash + u_Gap) - (u_Gap * 0.5);\n float left = max(travel - 0.5, -0.5);\n float right = min(travel + 0.5, u_Gap + 0.5);\n alpha *= max(0.0, right - left);\n }\n\n if (u_IsPicking > 0.5) {\n vec3 pickingColor = COLOR_SCALE * u_PickingColor;\n if (pickingColor.x == 0.0 && pickingColor.y == 0.0 && pickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(pickingColor, 1.0);\n } else {\n outputColor = u_StrokeColor;\n outputColor.a *= alpha * u_Opacity * u_StrokeOpacity;\n }\n}"; // eslint-disable-line
|
|
11113
11511
|
|
|
11512
|
+
var vert$2 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_ObjectParams {\n mat4 u_ModelMatrix;\n vec4 u_Color;\n vec4 u_StrokeColor;\n float u_StrokeWidth;\n float u_Opacity;\n float u_FillOpacity;\n float u_StrokeOpacity;\n float u_Expand;\n float u_MiterLimit;\n float u_ScaleMode;\n float u_Alignment;\n vec3 u_PickingColor;\n float u_Dash;\n float u_Gap;\n float u_DashOffset;\n float u_Visible;\n float u_ZIndex;\n float u_IncreasedLineWidthForHitTesting;\n};\n\nlayout(location = PREV) in vec2 a_Prev;\nlayout(location = POINT1) in vec2 a_Point1;\nlayout(location = POINT2) in vec2 a_Point2;\nlayout(location = NEXT) in vec2 a_Next;\nlayout(location = VERTEX_JOINT) in float a_VertexJoint;\nlayout(location = VERTEX_NUM) in float a_VertexNum;\nlayout(location = TRAVEL) in float a_Travel;\n\nconst float FILL = 1.0;\nconst float BEVEL = 4.0;\nconst float MITER = 8.0;\nconst float ROUND = 12.0;\nconst float JOINT_CAP_BUTT = 16.0;\nconst float JOINT_CAP_SQUARE = 18.0;\nconst float JOINT_CAP_ROUND = 20.0;\nconst float FILL_EXPAND = 24.0;\nconst float CAP_BUTT = 1.0;\nconst float CAP_SQUARE = 2.0;\nconst float CAP_ROUND = 3.0;\nconst float CAP_BUTT2 = 4.0;\n\nout vec4 v_Distance;\nout vec4 v_Arc;\nout float v_Type;\nout float v_Travel;\n\nvec2 doBisect(\n vec2 norm, float len, vec2 norm2, float len2, float dy, float inner\n) {\n vec2 bisect = (norm + norm2) / 2.0;\n bisect /= dot(norm, bisect);\n vec2 shift = dy * bisect;\n if (inner > 0.5) {\n if (len < len2) {\n if (abs(dy * (bisect.x * norm.y - bisect.y * norm.x)) > len) {\n return dy * norm;\n }\n } else {\n if (abs(dy * (bisect.x * norm2.y - bisect.y * norm2.x)) > len2) {\n return dy * norm;\n }\n }\n }\n return dy * bisect;\n}\n\nvoid main() {\n vec2 pointA = (u_ModelMatrix * vec4(a_Point1, 0., 1.0)).xy;\n vec2 pointB = (u_ModelMatrix * vec4(a_Point2, 0., 1.0)).xy;\n\n vec2 xBasis = pointB - pointA;\n float len = length(xBasis);\n vec2 forward = xBasis / len;\n vec2 norm = vec2(forward.y, -forward.x);\n\n float type = a_VertexJoint;\n\n float lineWidth;\n if (u_IsPicking > 0.5) {\n lineWidth = u_IncreasedLineWidthForHitTesting + u_StrokeWidth;\n } else {\n lineWidth = u_StrokeWidth;\n }\n\n if (u_ScaleMode > 2.5) {\n lineWidth *= length(u_ModelMatrix * vec4(1.0, 0.0, 0.0, 0.0));\n } else if (u_ScaleMode > 1.5) {\n lineWidth *= length(u_ModelMatrix * vec4(0.0, 1.0, 0.0, 0.0));\n } else if (u_ScaleMode > 0.5) {\n vec2 avgDiag = (u_ModelMatrix * vec4(1.0, 1.0, 0.0, 0.0)).xy;\n lineWidth *= sqrt(dot(avgDiag, avgDiag) * 0.5);\n }\n float capType = floor(type / 32.0);\n type -= capType * 32.0;\n v_Arc = vec4(0.0);\n lineWidth *= 0.5;\n float lineAlignment = 2.0 * u_Alignment - 1.0;\n\n vec2 pos;\n\n if (capType == CAP_ROUND) {\n if (a_VertexNum < 3.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n type = JOINT_CAP_ROUND;\n capType = 0.0;\n }\n\n if (type >= BEVEL) {\n float dy = lineWidth + u_Expand;\n float inner = 0.0;\n if (a_VertexNum >= 1.5) {\n dy = -dy;\n inner = 1.0;\n }\n\n vec2 base, next, xBasis2, bisect;\n float flag = 0.0;\n float sign2 = 1.0;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5 && a_VertexNum < 3.5) {\n next = (u_ModelMatrix * vec4(a_Prev, 0.0, 1.0)).xy;\n base = pointA;\n flag = type - floor(type / 2.0) * 2.0;\n sign2 = -1.0;\n\n } else {\n next = (u_ModelMatrix * vec4(a_Next, 0.0, 1.0)).xy;\n base = pointB;\n if (type >= MITER && type < MITER + 3.5) {\n flag = step(MITER + 1.5, type);\n // check miter limit here?\n }\n }\n xBasis2 = next - base;\n float len2 = length(xBasis2);\n vec2 norm2 = vec2(xBasis2.y, -xBasis2.x) / len2;\n float D = norm.x * norm2.y - norm.y * norm2.x;\n if (D < 0.0) {\n inner = 1.0 - inner;\n }\n norm2 *= sign2;\n\n if (abs(lineAlignment) > 0.01) {\n float shift = lineWidth * lineAlignment;\n pointA += norm * shift;\n pointB += norm * shift;\n if (abs(D) < 0.01) {\n base += norm * shift;\n } else {\n base += doBisect(norm, len, norm2, len2, shift, 0.0);\n }\n }\n\n float collinear = step(0.0, dot(norm, norm2));\n v_Type = 0.0;\n float dy2 = -1000.0;\n float dy3 = -1000.0;\n if (abs(D) < 0.01 && collinear < 0.5) {\n if (type >= ROUND && type < ROUND + 1.5) {\n type = JOINT_CAP_ROUND;\n }\n //TODO: BUTT here too\n }\n\n if (a_VertexNum < 3.5) {\n if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (flag < 0.5 && inner < 0.5) {\n pos = dy * norm;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, inner);\n }\n }\n if (capType >= CAP_BUTT && capType < CAP_ROUND) {\n float extra = step(CAP_SQUARE, capType) * lineWidth;\n vec2 back = -forward;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n pos += back * (u_Expand + extra);\n dy2 = u_Expand;\n } else {\n dy2 = dot(pos + base - pointA, back) - extra;\n }\n }\n if (type >= JOINT_CAP_BUTT && type < JOINT_CAP_SQUARE + 0.5) {\n float extra = step(JOINT_CAP_SQUARE, type) * lineWidth;\n if (a_VertexNum < 0.5 || a_VertexNum > 2.5) {\n dy3 = dot(pos + base - pointB, forward) - extra;\n } else {\n pos += forward * (u_Expand + extra);\n dy3 = u_Expand;\n if (capType >= CAP_BUTT) {\n dy2 -= u_Expand + extra;\n }\n }\n }\n } else if (type >= JOINT_CAP_ROUND && type < JOINT_CAP_ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n vec2 d2 = abs(dy) * forward;\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = dy * norm;\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum < 6.5) {\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n } else {\n dy = -dy;\n pos = dy * norm + d2;\n v_Arc.x = abs(dy);\n }\n dy2 = 0.0;\n v_Arc.y = dy;\n v_Arc.z = 0.0;\n v_Arc.w = lineWidth;\n v_Type = 3.0;\n } else if (abs(D) < 0.01) {\n pos = dy * norm;\n } else {\n if (type >= ROUND && type < ROUND + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n float d2 = abs(dy);\n if (length(pos) > abs(dy) * 1.5) {\n if (a_VertexNum < 6.5) {\n pos.x = dy * norm.x - d2 * norm.y;\n pos.y = dy * norm.y + d2 * norm.x;\n } else {\n pos.x = dy * norm2.x + d2 * norm2.y;\n pos.y = dy * norm2.y - d2 * norm2.x;\n }\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n v_Arc.x = sign * dot(pos, norm3);\n v_Arc.y = pos.x * norm3.y - pos.y * norm3.x;\n v_Arc.z = dot(norm, norm3) * lineWidth;\n v_Arc.w = lineWidth;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = v_Arc.z - v_Arc.x;\n v_Type = 3.0;\n } else {\n float hit = 0.0;\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (dot(norm, norm2) > 0.0) {\n type = MITER;\n }\n }\n if (type >= MITER && type < MITER + 3.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float sign = step(0.0, dy) * 2.0 - 1.0;\n pos = doBisect(norm, len, norm2, len2, dy, 0.0);\n if (length(pos) > abs(dy) * u_MiterLimit) {\n type = BEVEL;\n } else {\n if (a_VertexNum < 4.5) {\n dy = -dy;\n pos = doBisect(norm, len, norm2, len2, dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 6.5) {\n pos = dy * norm2;\n }\n v_Type = 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n hit = 1.0;\n }\n }\n if (type >= BEVEL && type < BEVEL + 1.5) {\n if (inner > 0.5) {\n dy = -dy;\n inner = 0.0;\n }\n float d2 = abs(dy);\n vec2 pos3 = vec2(dy * norm.x - d2 * norm.y, dy * norm.y + d2 * norm.x);\n vec2 pos4 = vec2(dy * norm2.x + d2 * norm2.y, dy * norm2.y - d2 * norm2.x);\n if (a_VertexNum < 4.5) {\n pos = doBisect(norm, len, norm2, len2, -dy, 1.0);\n } else if (a_VertexNum < 5.5) {\n pos = dy * norm;\n } else if (a_VertexNum > 7.5) {\n pos = dy * norm2;\n } else {\n if (a_VertexNum < 6.5) {\n pos = pos3;\n } else {\n pos = pos4;\n }\n }\n vec2 norm3 = normalize(norm + norm2);\n float sign = step(0.0, dy) * 2.0 - 1.0;\n dy = -sign * dot(pos, norm);\n dy2 = -sign * dot(pos, norm2);\n dy3 = (-sign * dot(pos, norm3)) + lineWidth;\n v_Type = 4.0;\n hit = 1.0;\n }\n if (hit < 0.5) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n }\n }\n pos += base;\n v_Distance = vec4(dy, dy2, dy3, lineWidth) * u_DevicePixelRatio;\n v_Arc = v_Arc * u_DevicePixelRatio;\n v_Travel = a_Travel + dot(pos - pointA, vec2(-norm.y, norm.x));\n }\n\n gl_Position = u_ProjectionMatrix * u_ViewMatrix * vec4(pos, u_ZIndex, 1.0);\n}"; // eslint-disable-line
|
|
11513
|
+
|
|
11114
11514
|
var JOINT_TYPE;
|
|
11115
11515
|
|
|
11116
11516
|
(function (JOINT_TYPE) {
|
|
@@ -11531,7 +11931,11 @@
|
|
|
11531
11931
|
} else if (command === 'Z' && (object.nodeName === g.Shape.PATH || object.nodeName === g.Shape.RECT)) {
|
|
11532
11932
|
var _points2;
|
|
11533
11933
|
|
|
11534
|
-
|
|
11934
|
+
var epsilon = 0.0001; // skip if already closed
|
|
11935
|
+
|
|
11936
|
+
if (Math.abs(points[points.length - 2] - points[startPointIndex]) > epsilon || Math.abs(points[points.length - 1] - points[startPointIndex + 1]) > epsilon) {
|
|
11937
|
+
points.push(points[startPointIndex], points[startPointIndex + 1]);
|
|
11938
|
+
}
|
|
11535
11939
|
|
|
11536
11940
|
(_points2 = points).push.apply(_points2, addTailSegment(points[startPointIndex], points[startPointIndex + 1], points[startPointIndex + 2], points[startPointIndex + 3]));
|
|
11537
11941
|
}
|
|
@@ -13177,6 +13581,7 @@
|
|
|
13177
13581
|
named: g.Shape.MESH
|
|
13178
13582
|
}]
|
|
13179
13583
|
})], MeshRenderer);
|
|
13584
|
+
var DeviceContribution = manaSyringe.Syringe.defineToken('DeviceContribution');
|
|
13180
13585
|
var _excluded = ["style"];
|
|
13181
13586
|
|
|
13182
13587
|
var Light = /*#__PURE__*/function (_DisplayObject) {
|
|
@@ -13233,7 +13638,6 @@
|
|
|
13233
13638
|
}(g.DisplayObject);
|
|
13234
13639
|
|
|
13235
13640
|
Fog.tag = 'fog';
|
|
13236
|
-
var DeviceContribution = manaSyringe.Syringe.defineToken('DeviceContribution');
|
|
13237
13641
|
|
|
13238
13642
|
var _class$1;
|
|
13239
13643
|
|
|
@@ -13355,10 +13759,10 @@
|
|
|
13355
13759
|
_this.batchManager.changeRenderOrder(object, renderOrder);
|
|
13356
13760
|
};
|
|
13357
13761
|
|
|
13358
|
-
renderingService.hooks.init.tapPromise(RenderGraphPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$
|
|
13762
|
+
renderingService.hooks.init.tapPromise(RenderGraphPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
13359
13763
|
var $canvas, _this$canvasConfig, width, height;
|
|
13360
13764
|
|
|
13361
|
-
return _regeneratorRuntime$
|
|
13765
|
+
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
13362
13766
|
while (1) {
|
|
13363
13767
|
switch (_context.prev = _context.next) {
|
|
13364
13768
|
case 0:
|
|
@@ -13390,7 +13794,7 @@
|
|
|
13390
13794
|
|
|
13391
13795
|
_this.swapChain.configureSwapChain($canvas.width, $canvas.height);
|
|
13392
13796
|
|
|
13393
|
-
_this.renderingContext.root.ownerDocument.defaultView.
|
|
13797
|
+
_this.renderingContext.root.ownerDocument.defaultView.addEventListener(g.CanvasEvent.RESIZE, function () {
|
|
13394
13798
|
_this.swapChain.configureSwapChain($canvas.width, $canvas.height);
|
|
13395
13799
|
});
|
|
13396
13800
|
|
|
@@ -13425,7 +13829,9 @@
|
|
|
13425
13829
|
_this.builder = _this.renderHelper.renderGraph.newGraphBuilder(); // use canvas.background
|
|
13426
13830
|
|
|
13427
13831
|
var backgroundColor = g.parseColor(_this.canvasConfig.background);
|
|
13428
|
-
var clearColor = _this.canvasConfig.background ?
|
|
13832
|
+
var clearColor = _this.canvasConfig.background ? // use premultipliedAlpha
|
|
13833
|
+
// @see https://canvatechblog.com/alpha-blending-and-webgl-99feb392779e
|
|
13834
|
+
colorNewFromRGBA(Number(backgroundColor.r) / 255 * Number(backgroundColor.alpha), Number(backgroundColor.g) / 255 * Number(backgroundColor.alpha), Number(backgroundColor.b) / 255 * Number(backgroundColor.alpha), Number(backgroundColor.alpha)) : TransparentBlack; // retrieve at each frame since canvas may resize
|
|
13429
13835
|
|
|
13430
13836
|
var renderInput = {
|
|
13431
13837
|
backbufferWidth: canvas.width,
|
|
@@ -13470,14 +13876,15 @@
|
|
|
13470
13876
|
numSamplers: 0
|
|
13471
13877
|
}]);
|
|
13472
13878
|
template.setMegaStateFlags(setAttachmentStateSimple({
|
|
13473
|
-
depthWrite: true
|
|
13879
|
+
depthWrite: true,
|
|
13880
|
+
blendConstant: TransparentBlack
|
|
13474
13881
|
}, {
|
|
13475
13882
|
rgbBlendMode: BlendMode.Add,
|
|
13476
13883
|
alphaBlendMode: BlendMode.Add,
|
|
13477
13884
|
rgbBlendSrcFactor: BlendFactor.SrcAlpha,
|
|
13478
|
-
alphaBlendSrcFactor: BlendFactor.
|
|
13885
|
+
alphaBlendSrcFactor: BlendFactor.One,
|
|
13479
13886
|
rgbBlendDstFactor: BlendFactor.OneMinusSrcAlpha,
|
|
13480
|
-
alphaBlendDstFactor: BlendFactor.
|
|
13887
|
+
alphaBlendDstFactor: BlendFactor.OneMinusSrcAlpha
|
|
13481
13888
|
})); // Update Scene Params
|
|
13482
13889
|
|
|
13483
13890
|
var _this$canvasConfig2 = _this.canvasConfig,
|
|
@@ -13601,8 +14008,8 @@
|
|
|
13601
14008
|
}
|
|
13602
14009
|
};
|
|
13603
14010
|
|
|
13604
|
-
renderingService.hooks.init.tapPromise(PickingPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$
|
|
13605
|
-
return _regeneratorRuntime$
|
|
14011
|
+
renderingService.hooks.init.tapPromise(PickingPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
14012
|
+
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
13606
14013
|
while (1) {
|
|
13607
14014
|
switch (_context.prev = _context.next) {
|
|
13608
14015
|
case 0:
|
|
@@ -13619,9 +14026,9 @@
|
|
|
13619
14026
|
_this.renderingContext.root.removeEventListener(g.ElementEvent.MOUNTED, handleMounted);
|
|
13620
14027
|
});
|
|
13621
14028
|
renderingService.hooks.pick.tapPromise(PickingPlugin_1.tag, /*#__PURE__*/function () {
|
|
13622
|
-
var _ref2 = _asyncToGenerator$
|
|
14029
|
+
var _ref2 = _asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee2(result) {
|
|
13623
14030
|
var topmost, position, x, y, dpr, width, height, xInDevicePixel, yInDevicePixel, pickedDisplayObjects;
|
|
13624
|
-
return _regeneratorRuntime$
|
|
14031
|
+
return _regeneratorRuntime$2().wrap(function _callee2$(_context2) {
|
|
13625
14032
|
while (1) {
|
|
13626
14033
|
switch (_context2.prev = _context2.next) {
|
|
13627
14034
|
case 0:
|
|
@@ -13666,9 +14073,9 @@
|
|
|
13666
14073
|
};
|
|
13667
14074
|
|
|
13668
14075
|
_proto.pickByRectangleInDepth = /*#__PURE__*/function () {
|
|
13669
|
-
var _pickByRectangleInDepth = _asyncToGenerator$
|
|
14076
|
+
var _pickByRectangleInDepth = _asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee3(rect, depth) {
|
|
13670
14077
|
var picked, counter, targets;
|
|
13671
|
-
return _regeneratorRuntime$
|
|
14078
|
+
return _regeneratorRuntime$2().wrap(function _callee3$(_context3) {
|
|
13672
14079
|
while (1) {
|
|
13673
14080
|
switch (_context3.prev = _context3.next) {
|
|
13674
14081
|
case 0:
|
|
@@ -13748,7 +14155,7 @@
|
|
|
13748
14155
|
var renderLists = this.renderGraphPlugin.getRenderLists();
|
|
13749
14156
|
var renderInstManager = this.renderHelper.renderInstManager;
|
|
13750
14157
|
var builder = this.renderHelper.renderGraph.newGraphBuilder();
|
|
13751
|
-
var clearColor =
|
|
14158
|
+
var clearColor = TransparentBlack; // retrieve at each frame since canvas may resize
|
|
13752
14159
|
|
|
13753
14160
|
var x = rect.x,
|
|
13754
14161
|
y = rect.y,
|
|
@@ -14362,6 +14769,7 @@
|
|
|
14362
14769
|
copyMegaState: copyMegaState,
|
|
14363
14770
|
defaultBindingLayoutSamplerDescriptor: defaultBindingLayoutSamplerDescriptor,
|
|
14364
14771
|
defaultMegaState: defaultMegaState,
|
|
14772
|
+
definedProps: definedProps,
|
|
14365
14773
|
enumToObject: enumToObject,
|
|
14366
14774
|
fallbackUndefined: fallbackUndefined,
|
|
14367
14775
|
fillArray: fillArray,
|
|
@@ -14451,9 +14859,9 @@
|
|
|
14451
14859
|
vertexAttributeDescriptorEquals: vertexAttributeDescriptorEquals
|
|
14452
14860
|
});
|
|
14453
14861
|
|
|
14454
|
-
function _regeneratorRuntime$
|
|
14862
|
+
function _regeneratorRuntime$3() {
|
|
14455
14863
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
14456
|
-
_regeneratorRuntime$
|
|
14864
|
+
_regeneratorRuntime$3 = function _regeneratorRuntime() {
|
|
14457
14865
|
return exports;
|
|
14458
14866
|
};
|
|
14459
14867
|
|
|
@@ -14801,7 +15209,7 @@
|
|
|
14801
15209
|
}, exports;
|
|
14802
15210
|
}
|
|
14803
15211
|
|
|
14804
|
-
function asyncGeneratorStep$
|
|
15212
|
+
function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
|
|
14805
15213
|
try {
|
|
14806
15214
|
var info = gen[key](arg);
|
|
14807
15215
|
var value = info.value;
|
|
@@ -14817,7 +15225,7 @@
|
|
|
14817
15225
|
}
|
|
14818
15226
|
}
|
|
14819
15227
|
|
|
14820
|
-
function _asyncToGenerator$
|
|
15228
|
+
function _asyncToGenerator$3(fn) {
|
|
14821
15229
|
return function () {
|
|
14822
15230
|
var self = this,
|
|
14823
15231
|
args = arguments;
|
|
@@ -14825,11 +15233,11 @@
|
|
|
14825
15233
|
var gen = fn.apply(self, args);
|
|
14826
15234
|
|
|
14827
15235
|
function _next(value) {
|
|
14828
|
-
asyncGeneratorStep$
|
|
15236
|
+
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
|
|
14829
15237
|
}
|
|
14830
15238
|
|
|
14831
15239
|
function _throw(err) {
|
|
14832
|
-
asyncGeneratorStep$
|
|
15240
|
+
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
|
|
14833
15241
|
}
|
|
14834
15242
|
|
|
14835
15243
|
_next(undefined);
|
|
@@ -17211,9 +17619,9 @@
|
|
|
17211
17619
|
}
|
|
17212
17620
|
|
|
17213
17621
|
function _load() {
|
|
17214
|
-
_load = _asyncToGenerator$
|
|
17622
|
+
_load = _asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee(module, imports) {
|
|
17215
17623
|
var bytes, instance;
|
|
17216
|
-
return _regeneratorRuntime$
|
|
17624
|
+
return _regeneratorRuntime$3().wrap(function _callee$(_context) {
|
|
17217
17625
|
while (1) {
|
|
17218
17626
|
switch (_context.prev = _context.next) {
|
|
17219
17627
|
case 0:
|
|
@@ -17297,10 +17705,10 @@
|
|
|
17297
17705
|
}
|
|
17298
17706
|
|
|
17299
17707
|
function _init() {
|
|
17300
|
-
_init = _asyncToGenerator$
|
|
17708
|
+
_init = _asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee2(input) {
|
|
17301
17709
|
var imports, _yield$load, instance, module;
|
|
17302
17710
|
|
|
17303
|
-
return _regeneratorRuntime$
|
|
17711
|
+
return _regeneratorRuntime$3().wrap(function _callee2$(_context2) {
|
|
17304
17712
|
while (1) {
|
|
17305
17713
|
switch (_context2.prev = _context2.next) {
|
|
17306
17714
|
case 0:
|
|
@@ -17368,9 +17776,9 @@
|
|
|
17368
17776
|
var _proto = WebGPUDeviceContribution.prototype;
|
|
17369
17777
|
|
|
17370
17778
|
_proto.createSwapChain = /*#__PURE__*/function () {
|
|
17371
|
-
var _createSwapChain = _asyncToGenerator$
|
|
17779
|
+
var _createSwapChain = _asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee($canvas) {
|
|
17372
17780
|
var adapter, optionalFeatures, requiredFeatures, device, context;
|
|
17373
|
-
return _regeneratorRuntime$
|
|
17781
|
+
return _regeneratorRuntime$3().wrap(function _callee$(_context) {
|
|
17374
17782
|
while (1) {
|
|
17375
17783
|
switch (_context.prev = _context.next) {
|
|
17376
17784
|
case 0:
|
|
@@ -17512,9 +17920,9 @@
|
|
|
17512
17920
|
Plugin: Plugin$2
|
|
17513
17921
|
});
|
|
17514
17922
|
|
|
17515
|
-
function _regeneratorRuntime$
|
|
17923
|
+
function _regeneratorRuntime$4() {
|
|
17516
17924
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
17517
|
-
_regeneratorRuntime$
|
|
17925
|
+
_regeneratorRuntime$4 = function _regeneratorRuntime() {
|
|
17518
17926
|
return exports;
|
|
17519
17927
|
};
|
|
17520
17928
|
|
|
@@ -17862,7 +18270,7 @@
|
|
|
17862
18270
|
}, exports;
|
|
17863
18271
|
}
|
|
17864
18272
|
|
|
17865
|
-
function asyncGeneratorStep$
|
|
18273
|
+
function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
|
|
17866
18274
|
try {
|
|
17867
18275
|
var info = gen[key](arg);
|
|
17868
18276
|
var value = info.value;
|
|
@@ -17878,7 +18286,7 @@
|
|
|
17878
18286
|
}
|
|
17879
18287
|
}
|
|
17880
18288
|
|
|
17881
|
-
function _asyncToGenerator$
|
|
18289
|
+
function _asyncToGenerator$4(fn) {
|
|
17882
18290
|
return function () {
|
|
17883
18291
|
var self = this,
|
|
17884
18292
|
args = arguments;
|
|
@@ -17886,11 +18294,11 @@
|
|
|
17886
18294
|
var gen = fn.apply(self, args);
|
|
17887
18295
|
|
|
17888
18296
|
function _next(value) {
|
|
17889
|
-
asyncGeneratorStep$
|
|
18297
|
+
asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
|
|
17890
18298
|
}
|
|
17891
18299
|
|
|
17892
18300
|
function _throw(err) {
|
|
17893
|
-
asyncGeneratorStep$
|
|
18301
|
+
asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
|
|
17894
18302
|
}
|
|
17895
18303
|
|
|
17896
18304
|
_next(undefined);
|
|
@@ -17906,6 +18314,7 @@
|
|
|
17906
18314
|
function HTMLRenderingPlugin() {
|
|
17907
18315
|
this.contextService = void 0;
|
|
17908
18316
|
this.renderingContext = void 0;
|
|
18317
|
+
this.canvasConfig = void 0;
|
|
17909
18318
|
this.$camera = void 0;
|
|
17910
18319
|
}
|
|
17911
18320
|
|
|
@@ -17959,8 +18368,8 @@
|
|
|
17959
18368
|
}
|
|
17960
18369
|
};
|
|
17961
18370
|
|
|
17962
|
-
renderingService.hooks.init.tapPromise(HTMLRenderingPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$
|
|
17963
|
-
return _regeneratorRuntime$
|
|
18371
|
+
renderingService.hooks.init.tapPromise(HTMLRenderingPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$4( /*#__PURE__*/_regeneratorRuntime$4().mark(function _callee() {
|
|
18372
|
+
return _regeneratorRuntime$4().wrap(function _callee$(_context) {
|
|
17964
18373
|
while (1) {
|
|
17965
18374
|
switch (_context.prev = _context.next) {
|
|
17966
18375
|
case 0:
|
|
@@ -17991,6 +18400,7 @@
|
|
|
17991
18400
|
};
|
|
17992
18401
|
|
|
17993
18402
|
_proto.getOrCreateEl = function getOrCreateEl(object) {
|
|
18403
|
+
var doc = this.canvasConfig.document;
|
|
17994
18404
|
var existedId = this.getId(object);
|
|
17995
18405
|
var $container = this.contextService.getDomElement().parentNode;
|
|
17996
18406
|
|
|
@@ -17998,7 +18408,7 @@
|
|
|
17998
18408
|
var $existedElement = $container.querySelector('#' + existedId);
|
|
17999
18409
|
|
|
18000
18410
|
if (!$existedElement) {
|
|
18001
|
-
$existedElement = document.createElement('div');
|
|
18411
|
+
$existedElement = (doc || document).createElement('div');
|
|
18002
18412
|
object.parsedStyle.$el = $existedElement;
|
|
18003
18413
|
$existedElement.id = existedId;
|
|
18004
18414
|
|
|
@@ -18129,6 +18539,8 @@
|
|
|
18129
18539
|
|
|
18130
18540
|
__decorate([manaSyringe.inject(g.RenderingContext), __metadata("design:type", Object)], HTMLRenderingPlugin.prototype, "renderingContext", void 0);
|
|
18131
18541
|
|
|
18542
|
+
__decorate([manaSyringe.inject(g.CanvasConfig), __metadata("design:type", Object)], HTMLRenderingPlugin.prototype, "canvasConfig", void 0);
|
|
18543
|
+
|
|
18132
18544
|
HTMLRenderingPlugin = HTMLRenderingPlugin_1 = __decorate([manaSyringe.singleton({
|
|
18133
18545
|
contrib: g.RenderingPluginContribution
|
|
18134
18546
|
})], HTMLRenderingPlugin);
|
|
@@ -18165,43 +18577,61 @@
|
|
|
18165
18577
|
|
|
18166
18578
|
var _proto = WebGLContextService.prototype;
|
|
18167
18579
|
|
|
18168
|
-
_proto.init = function
|
|
18169
|
-
var
|
|
18170
|
-
|
|
18171
|
-
canvas = _this$canvasConfig.canvas,
|
|
18172
|
-
devicePixelRatio = _this$canvasConfig.devicePixelRatio;
|
|
18580
|
+
_proto.init = /*#__PURE__*/function () {
|
|
18581
|
+
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
18582
|
+
var _this$canvasConfig, container, canvas, devicePixelRatio, $canvas, dpr;
|
|
18173
18583
|
|
|
18174
|
-
|
|
18175
|
-
|
|
18584
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
18585
|
+
while (1) {
|
|
18586
|
+
switch (_context.prev = _context.next) {
|
|
18587
|
+
case 0:
|
|
18588
|
+
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, canvas = _this$canvasConfig.canvas, devicePixelRatio = _this$canvasConfig.devicePixelRatio;
|
|
18176
18589
|
|
|
18177
|
-
|
|
18178
|
-
|
|
18179
|
-
}
|
|
18590
|
+
if (canvas) {
|
|
18591
|
+
this.$canvas = canvas;
|
|
18180
18592
|
|
|
18181
|
-
|
|
18182
|
-
|
|
18183
|
-
|
|
18184
|
-
// create container
|
|
18185
|
-
this.$container = g.isString(container) ? document.getElementById(container) : container;
|
|
18593
|
+
if (container && canvas.parentElement !== container) {
|
|
18594
|
+
container.appendChild(canvas);
|
|
18595
|
+
}
|
|
18186
18596
|
|
|
18187
|
-
|
|
18188
|
-
|
|
18189
|
-
|
|
18190
|
-
|
|
18597
|
+
this.$container = canvas.parentElement;
|
|
18598
|
+
this.canvasConfig.container = this.$container;
|
|
18599
|
+
} else if (container) {
|
|
18600
|
+
// create container
|
|
18601
|
+
this.$container = g.isString(container) ? document.getElementById(container) : container;
|
|
18191
18602
|
|
|
18192
|
-
|
|
18193
|
-
|
|
18194
|
-
|
|
18603
|
+
if (this.$container) {
|
|
18604
|
+
// create canvas
|
|
18605
|
+
$canvas = document.createElement('canvas');
|
|
18606
|
+
this.$container.appendChild($canvas);
|
|
18195
18607
|
|
|
18196
|
-
|
|
18197
|
-
|
|
18198
|
-
|
|
18608
|
+
if (!this.$container.style.position) {
|
|
18609
|
+
this.$container.style.position = 'relative';
|
|
18610
|
+
}
|
|
18611
|
+
|
|
18612
|
+
this.$canvas = $canvas;
|
|
18613
|
+
}
|
|
18614
|
+
} // use user-defined dpr first
|
|
18199
18615
|
|
|
18200
18616
|
|
|
18201
|
-
|
|
18202
|
-
|
|
18203
|
-
|
|
18204
|
-
|
|
18617
|
+
dpr = devicePixelRatio || g.isBrowser && window.devicePixelRatio || 1;
|
|
18618
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
18619
|
+
this.dpr = dpr;
|
|
18620
|
+
|
|
18621
|
+
case 5:
|
|
18622
|
+
case "end":
|
|
18623
|
+
return _context.stop();
|
|
18624
|
+
}
|
|
18625
|
+
}
|
|
18626
|
+
}, _callee, this);
|
|
18627
|
+
}));
|
|
18628
|
+
|
|
18629
|
+
function init() {
|
|
18630
|
+
return _init.apply(this, arguments);
|
|
18631
|
+
}
|
|
18632
|
+
|
|
18633
|
+
return init;
|
|
18634
|
+
}();
|
|
18205
18635
|
|
|
18206
18636
|
_proto.getDomElement = function getDomElement() {
|
|
18207
18637
|
return this.$canvas;
|