@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.mjs
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
|
import * as THREE from 'three';
|
|
@@ -9325,11 +9325,9 @@ var Matrix4 = /** @class */ (function () {
|
|
|
9325
9325
|
var vX = Matrix4.tempVec0;
|
|
9326
9326
|
var vY = Matrix4.tempVec1;
|
|
9327
9327
|
var vZ = Matrix4.tempVec2;
|
|
9328
|
-
vZ.subtractVectors(
|
|
9328
|
+
vZ.subtractVectors(eye, target);
|
|
9329
9329
|
vZ.normalize();
|
|
9330
|
-
|
|
9331
|
-
vY.normalize();
|
|
9332
|
-
vX.crossVectors(vY, vZ);
|
|
9330
|
+
vX.crossVectors(up, vZ);
|
|
9333
9331
|
vX.normalize();
|
|
9334
9332
|
vY.crossVectors(vZ, vX);
|
|
9335
9333
|
var te = this.elements;
|
|
@@ -16018,7 +16016,7 @@ function loadImage(source) {
|
|
|
16018
16016
|
}
|
|
16019
16017
|
// 2. 非法类型
|
|
16020
16018
|
if (!url) {
|
|
16021
|
-
throw new Error("Invalid url type: ".concat(source));
|
|
16019
|
+
throw new Error("Invalid url type: ".concat(JSON.stringify(source)));
|
|
16022
16020
|
}
|
|
16023
16021
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
16024
16022
|
var img = new Image();
|
|
@@ -16037,7 +16035,7 @@ function loadImage(source) {
|
|
|
16037
16035
|
if (revokeURL) {
|
|
16038
16036
|
URL.revokeObjectURL(url);
|
|
16039
16037
|
}
|
|
16040
|
-
return reject("Load image fail: ".concat(e));
|
|
16038
|
+
return reject("Load image fail: ".concat(JSON.stringify(e)));
|
|
16041
16039
|
};
|
|
16042
16040
|
img.src = url;
|
|
16043
16041
|
})];
|
|
@@ -29234,7 +29232,6 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29234
29232
|
CompositionSourceManager.prototype.assembleItems = function (composition) {
|
|
29235
29233
|
var _this = this;
|
|
29236
29234
|
var items = [];
|
|
29237
|
-
this.mask++;
|
|
29238
29235
|
composition.items.forEach(function (item) {
|
|
29239
29236
|
var _a;
|
|
29240
29237
|
var option = {};
|
|
@@ -29250,9 +29247,7 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29250
29247
|
option.type = type;
|
|
29251
29248
|
if (renderContent.renderer) {
|
|
29252
29249
|
renderContent.renderer = _this.changeTex(renderContent.renderer);
|
|
29253
|
-
|
|
29254
|
-
_this.processMask(renderContent.renderer, _this.mask);
|
|
29255
|
-
}
|
|
29250
|
+
_this.processMask(renderContent.renderer);
|
|
29256
29251
|
var split = renderContent.splits && !renderContent.textureSheetAnimation && renderContent.splits[0];
|
|
29257
29252
|
if (Number.isInteger(renderContent.renderer.shape)) {
|
|
29258
29253
|
// TODO: scene.shapes 类型问题?
|
|
@@ -29297,7 +29292,7 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29297
29292
|
}
|
|
29298
29293
|
// 处理预合成的渲染顺序
|
|
29299
29294
|
if (option.type === ItemType$1.composition) {
|
|
29300
|
-
|
|
29295
|
+
++_this.mask;
|
|
29301
29296
|
var refId = item.content.options.refId;
|
|
29302
29297
|
if (!_this.refCompositions.get(refId)) {
|
|
29303
29298
|
throw new Error('Invalid Ref Composition id: ' + refId);
|
|
@@ -29308,7 +29303,7 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29308
29303
|
}
|
|
29309
29304
|
ref.items.forEach(function (item) {
|
|
29310
29305
|
item.listIndex = listOrder++;
|
|
29311
|
-
_this.processMask(item.content
|
|
29306
|
+
_this.processMask(item.content);
|
|
29312
29307
|
});
|
|
29313
29308
|
option.items = ref.items;
|
|
29314
29309
|
}
|
|
@@ -29347,11 +29342,17 @@ var CompositionSourceManager = /** @class */ (function () {
|
|
|
29347
29342
|
/**
|
|
29348
29343
|
* 处理蒙版和遮挡关系写入 stencil 的 ref 值
|
|
29349
29344
|
*/
|
|
29350
|
-
CompositionSourceManager.prototype.processMask = function (renderer
|
|
29345
|
+
CompositionSourceManager.prototype.processMask = function (renderer) {
|
|
29346
|
+
if (renderer.maskMode === MaskMode$1.NONE) {
|
|
29347
|
+
return;
|
|
29348
|
+
}
|
|
29351
29349
|
if (!renderer.mask) {
|
|
29352
29350
|
var maskMode = renderer.maskMode;
|
|
29353
|
-
if (maskMode
|
|
29354
|
-
renderer.mask =
|
|
29351
|
+
if (maskMode === MaskMode$1.MASK) {
|
|
29352
|
+
renderer.mask = ++this.mask;
|
|
29353
|
+
}
|
|
29354
|
+
else if (maskMode === MaskMode$1.OBSCURED || maskMode === MaskMode$1.REVERSE_OBSCURED) {
|
|
29355
|
+
renderer.mask = this.mask;
|
|
29355
29356
|
}
|
|
29356
29357
|
}
|
|
29357
29358
|
};
|
|
@@ -29429,7 +29430,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29429
29430
|
waitPromise = new Promise(function (resolve, reject) {
|
|
29430
29431
|
return loadTimer = window.setTimeout(function () {
|
|
29431
29432
|
cancelLoading = true;
|
|
29432
|
-
reject("Load time out: ".concat(url));
|
|
29433
|
+
reject("Load time out: ".concat(JSON.stringify(url)));
|
|
29433
29434
|
}, _this.timeout * 1000);
|
|
29434
29435
|
});
|
|
29435
29436
|
hookTimeInfo = function (label, func) { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -29594,7 +29595,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29594
29595
|
if (passRenderLevel(bin.renderLevel, renderLevel)) {
|
|
29595
29596
|
return _this.loadBins(bin.url);
|
|
29596
29597
|
}
|
|
29597
|
-
throw new Error("Invalid bins source: ".concat(bins));
|
|
29598
|
+
throw new Error("Invalid bins source: ".concat(JSON.stringify(bins)));
|
|
29598
29599
|
});
|
|
29599
29600
|
return [2 /*return*/, Promise.all(jobs)];
|
|
29600
29601
|
});
|
|
@@ -29630,7 +29631,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29630
29631
|
case 3:
|
|
29631
29632
|
_b.sent();
|
|
29632
29633
|
console.warn({
|
|
29633
|
-
content: "Invalid fonts source: ".concat(font.fontURL),
|
|
29634
|
+
content: "Invalid fonts source: ".concat(JSON.stringify(font.fontURL)),
|
|
29634
29635
|
type: LOG_TYPE,
|
|
29635
29636
|
});
|
|
29636
29637
|
return [3 /*break*/, 4];
|
|
@@ -29799,7 +29800,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29799
29800
|
return __generator(this, function (_a) {
|
|
29800
29801
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
29801
29802
|
_this.downloader.downloadJSON(url, resolve, function (status, responseText) {
|
|
29802
|
-
reject("Couldn't load JSON ".concat(url, ": status ").concat(status, ", ").concat(responseText));
|
|
29803
|
+
reject("Couldn't load JSON ".concat(JSON.stringify(url), ": status ").concat(status, ", ").concat(responseText));
|
|
29803
29804
|
});
|
|
29804
29805
|
})];
|
|
29805
29806
|
});
|
|
@@ -29811,7 +29812,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
29811
29812
|
return __generator(this, function (_a) {
|
|
29812
29813
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
29813
29814
|
_this.downloader.downloadBinary(url, resolve, function (status, responseText) {
|
|
29814
|
-
reject("Couldn't load bins ".concat(url, ": status ").concat(status, ", ").concat(responseText));
|
|
29815
|
+
reject("Couldn't load bins ".concat(JSON.stringify(url), ": status ").concat(status, ", ").concat(responseText));
|
|
29815
29816
|
});
|
|
29816
29817
|
})];
|
|
29817
29818
|
});
|
|
@@ -31157,7 +31158,10 @@ var Ticker = /** @class */ (function () {
|
|
|
31157
31158
|
};
|
|
31158
31159
|
Ticker.prototype.setFPS = function (fps) {
|
|
31159
31160
|
this.targetFPS = clamp$1(fps, 1, 120);
|
|
31160
|
-
|
|
31161
|
+
// 注意:-2 的原因是保证帧率稳定
|
|
31162
|
+
// interval 在 fps 为 60 的时候设成 15 累计误差会很大,设成 14 较稳定
|
|
31163
|
+
// requestanimationFrame 在不同的刷新率下时间间隔不一样,120hz 的误差在 8 以内,60hz 的误差在 16 以内
|
|
31164
|
+
this.interval = Math.floor(1000 / fps) - 2;
|
|
31161
31165
|
};
|
|
31162
31166
|
/**
|
|
31163
31167
|
* 获取定时器暂停标志位
|
|
@@ -32757,9 +32761,9 @@ Geometry.create = function (engine, options) {
|
|
|
32757
32761
|
Mesh.create = function (engine, props) {
|
|
32758
32762
|
return new ThreeMesh(engine, props);
|
|
32759
32763
|
};
|
|
32760
|
-
var version = "1.1.
|
|
32764
|
+
var version = "1.1.3";
|
|
32761
32765
|
console.info({
|
|
32762
|
-
content: '[Galacean Effects THREEJS] version: ' + "1.1.
|
|
32766
|
+
content: '[Galacean Effects THREEJS] version: ' + "1.1.3",
|
|
32763
32767
|
type: LOG_TYPE,
|
|
32764
32768
|
});
|
|
32765
32769
|
|