@galacean/effects-threejs 1.1.2 → 1.1.3
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 +28 -24
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +28 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v1.1.
|
|
6
|
+
* Version: v1.1.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -9349,11 +9349,9 @@ var Matrix4 = /** @class */ (function () {
|
|
|
9349
9349
|
var vX = Matrix4.tempVec0;
|
|
9350
9350
|
var vY = Matrix4.tempVec1;
|
|
9351
9351
|
var vZ = Matrix4.tempVec2;
|
|
9352
|
-
vZ.subtractVectors(
|
|
9352
|
+
vZ.subtractVectors(eye, target);
|
|
9353
9353
|
vZ.normalize();
|
|
9354
|
-
|
|
9355
|
-
vY.normalize();
|
|
9356
|
-
vX.crossVectors(vY, vZ);
|
|
9354
|
+
vX.crossVectors(up, vZ);
|
|
9357
9355
|
vX.normalize();
|
|
9358
9356
|
vY.crossVectors(vZ, vX);
|
|
9359
9357
|
var te = this.elements;
|
|
@@ -16042,7 +16040,7 @@ function loadImage(source) {
|
|
|
16042
16040
|
}
|
|
16043
16041
|
// 2. 非法类型
|
|
16044
16042
|
if (!url) {
|
|
16045
|
-
throw new Error("Invalid url type: ".concat(source));
|
|
16043
|
+
throw new Error("Invalid url type: ".concat(JSON.stringify(source)));
|
|
16046
16044
|
}
|
|
16047
16045
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
16048
16046
|
var img = new Image();
|
|
@@ -16061,7 +16059,7 @@ function loadImage(source) {
|
|
|
16061
16059
|
if (revokeURL) {
|
|
16062
16060
|
URL.revokeObjectURL(url);
|
|
16063
16061
|
}
|
|
16064
|
-
return reject("Load image fail: ".concat(e));
|
|
16062
|
+
return reject("Load image fail: ".concat(JSON.stringify(e)));
|
|
16065
16063
|
};
|
|
16066
16064
|
img.src = url;
|
|
16067
16065
|
})];
|
|
@@ -29258,7 +29256,6 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29258
29256
|
CompositionSourceManager.prototype.assembleItems = function (composition) {
|
|
29259
29257
|
var _this = this;
|
|
29260
29258
|
var items = [];
|
|
29261
|
-
this.mask++;
|
|
29262
29259
|
composition.items.forEach(function (item) {
|
|
29263
29260
|
var _a;
|
|
29264
29261
|
var option = {};
|
|
@@ -29274,9 +29271,7 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29274
29271
|
option.type = type;
|
|
29275
29272
|
if (renderContent.renderer) {
|
|
29276
29273
|
renderContent.renderer = _this.changeTex(renderContent.renderer);
|
|
29277
|
-
|
|
29278
|
-
_this.processMask(renderContent.renderer, _this.mask);
|
|
29279
|
-
}
|
|
29274
|
+
_this.processMask(renderContent.renderer);
|
|
29280
29275
|
var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
|
|
29281
29276
|
if (Number.isInteger(renderContent.renderer.shape)) {
|
|
29282
29277
|
// TODO: scene.shapes 类型问题?
|
|
@@ -29321,7 +29316,7 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29321
29316
|
}
|
|
29322
29317
|
// 处理预合成的渲染顺序
|
|
29323
29318
|
if (option.type === ItemType$1.composition) {
|
|
29324
|
-
|
|
29319
|
+
++_this.mask;
|
|
29325
29320
|
var refId = item.content.options.refId;
|
|
29326
29321
|
if (!_this.refCompositions.get(refId)) {
|
|
29327
29322
|
throw new Error('Invalid Ref Composition id: ' + refId);
|
|
@@ -29332,7 +29327,7 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29332
29327
|
}
|
|
29333
29328
|
ref.items.forEach(function (item) {
|
|
29334
29329
|
item.listIndex = listOrder++;
|
|
29335
|
-
_this.processMask(item.content
|
|
29330
|
+
_this.processMask(item.content);
|
|
29336
29331
|
});
|
|
29337
29332
|
option.items = ref.items;
|
|
29338
29333
|
}
|
|
@@ -29371,11 +29366,17 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29371
29366
|
/**
|
|
29372
29367
|
* 处理蒙版和遮挡关系写入 stencil 的 ref 值
|
|
29373
29368
|
*/
|
|
29374
|
-
CompositionSourceManager.prototype.processMask = function (renderer
|
|
29369
|
+
CompositionSourceManager.prototype.processMask = function (renderer) {
|
|
29370
|
+
if (renderer.maskMode === MaskMode$1.NONE) {
|
|
29371
|
+
return;
|
|
29372
|
+
}
|
|
29375
29373
|
if (!renderer.mask) {
|
|
29376
29374
|
var maskMode = renderer.maskMode;
|
|
29377
|
-
if (maskMode
|
|
29378
|
-
renderer.mask =
|
|
29375
|
+
if (maskMode === MaskMode$1.MASK) {
|
|
29376
|
+
renderer.mask = ++this.mask;
|
|
29377
|
+
}
|
|
29378
|
+
else if (maskMode === MaskMode$1.OBSCURED || maskMode === MaskMode$1.REVERSE_OBSCURED) {
|
|
29379
|
+
renderer.mask = this.mask;
|
|
29379
29380
|
}
|
|
29380
29381
|
}
|
|
29381
29382
|
};
|
|
@@ -29453,7 +29454,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29453
29454
|
waitPromise = new Promise(function (resolve, reject) {
|
|
29454
29455
|
return loadTimer = window.setTimeout(function () {
|
|
29455
29456
|
cancelLoading = true;
|
|
29456
|
-
reject("Load time out: ".concat(url));
|
|
29457
|
+
reject("Load time out: ".concat(JSON.stringify(url)));
|
|
29457
29458
|
}, _this.timeout * 1000);
|
|
29458
29459
|
});
|
|
29459
29460
|
hookTimeInfo = function (label, func) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -29618,7 +29619,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29618
29619
|
if (passRenderLevel(bin.renderLevel, renderLevel)) {
|
|
29619
29620
|
return _this.loadBins(bin.url);
|
|
29620
29621
|
}
|
|
29621
|
-
throw new Error("Invalid bins source: ".concat(bins));
|
|
29622
|
+
throw new Error("Invalid bins source: ".concat(JSON.stringify(bins)));
|
|
29622
29623
|
});
|
|
29623
29624
|
return [2 /*return*/, Promise.all(jobs)];
|
|
29624
29625
|
});
|
|
@@ -29654,7 +29655,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29654
29655
|
case 3:
|
|
29655
29656
|
_b.sent();
|
|
29656
29657
|
console.warn({
|
|
29657
|
-
content: "Invalid fonts source: ".concat(font.fontURL),
|
|
29658
|
+
content: "Invalid fonts source: ".concat(JSON.stringify(font.fontURL)),
|
|
29658
29659
|
type: LOG_TYPE,
|
|
29659
29660
|
});
|
|
29660
29661
|
return [3 /*break*/, 4];
|
|
@@ -29823,7 +29824,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29823
29824
|
return __generator(this, function (_a) {
|
|
29824
29825
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
29825
29826
|
_this.downloader.downloadJSON(url, resolve, function (status, responseText) {
|
|
29826
|
-
reject("Couldn't load JSON ".concat(url, ": status ").concat(status, ", ").concat(responseText));
|
|
29827
|
+
reject("Couldn't load JSON ".concat(JSON.stringify(url), ": status ").concat(status, ", ").concat(responseText));
|
|
29827
29828
|
});
|
|
29828
29829
|
})];
|
|
29829
29830
|
});
|
|
@@ -29835,7 +29836,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29835
29836
|
return __generator(this, function (_a) {
|
|
29836
29837
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
29837
29838
|
_this.downloader.downloadBinary(url, resolve, function (status, responseText) {
|
|
29838
|
-
reject("Couldn't load bins ".concat(url, ": status ").concat(status, ", ").concat(responseText));
|
|
29839
|
+
reject("Couldn't load bins ".concat(JSON.stringify(url), ": status ").concat(status, ", ").concat(responseText));
|
|
29839
29840
|
});
|
|
29840
29841
|
})];
|
|
29841
29842
|
});
|
|
@@ -31181,7 +31182,10 @@ var Ticker = /** @class */ (function () {
|
|
|
31181
31182
|
};
|
|
31182
31183
|
Ticker.prototype.setFPS = function (fps) {
|
|
31183
31184
|
this.targetFPS = clamp$1(fps, 1, 120);
|
|
31184
|
-
|
|
31185
|
+
// 注意:-2 的原因是保证帧率稳定
|
|
31186
|
+
// interval 在 fps 为 60 的时候设成 15 累计误差会很大,设成 14 较稳定
|
|
31187
|
+
// requestanimationFrame 在不同的刷新率下时间间隔不一样,120hz 的误差在 8 以内,60hz 的误差在 16 以内
|
|
31188
|
+
this.interval = Math.floor(1000 / fps) - 2;
|
|
31185
31189
|
};
|
|
31186
31190
|
/**
|
|
31187
31191
|
* 获取定时器暂停标志位
|
|
@@ -32781,9 +32785,9 @@ Geometry.create = function (engine, options) {
|
|
|
32781
32785
|
Mesh.create = function (engine, props) {
|
|
32782
32786
|
return new ThreeMesh(engine, props);
|
|
32783
32787
|
};
|
|
32784
|
-
var version = "1.1.
|
|
32788
|
+
var version = "1.1.3";
|
|
32785
32789
|
console.info({
|
|
32786
|
-
content: '[Galacean Effects THREEJS] version: ' + "1.1.
|
|
32790
|
+
content: '[Galacean Effects THREEJS] version: ' + "1.1.3",
|
|
32787
32791
|
type: LOG_TYPE,
|
|
32788
32792
|
});
|
|
32789
32793
|
|