@galacean/effects 1.2.3 → 1.2.5
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 +34 -26
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +34 -26
- package/dist/index.mjs.map +1 -1
- package/dist/player.d.ts +1 -1
- package/dist/weapp.js +33 -25
- package/dist/weapp.js.map +1 -1
- package/dist/weapp.mjs +33 -25
- package/dist/weapp.mjs.map +1 -1
- package/package.json +3 -3
package/dist/player.d.ts
CHANGED
|
@@ -163,7 +163,7 @@ export declare class Player implements Disposable, LostHandler, RestoreHandler {
|
|
|
163
163
|
private resumePending;
|
|
164
164
|
private offscreenMode;
|
|
165
165
|
private disposed;
|
|
166
|
-
private
|
|
166
|
+
private assetManagers;
|
|
167
167
|
private speed;
|
|
168
168
|
private baseCompositionIndex;
|
|
169
169
|
/**
|
package/dist/weapp.js
CHANGED
|
@@ -9241,10 +9241,10 @@ var VFXItem = /** @class */ (function () {
|
|
|
9241
9241
|
};
|
|
9242
9242
|
VFXItem.prototype.translateByPixel = function (x, y) {
|
|
9243
9243
|
if (this.composition) {
|
|
9244
|
+
// @ts-expect-error
|
|
9245
|
+
var _a = this.composition.renderer.canvas.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
9244
9246
|
var z = this.transform.getWorldPosition().z;
|
|
9245
|
-
var
|
|
9246
|
-
var width = this.composition.renderer.getWidth() / 2;
|
|
9247
|
-
var height = this.composition.renderer.getHeight() / 2;
|
|
9247
|
+
var _b = this.composition.camera.getInverseVPRatio(z), rx = _b.x, ry = _b.y;
|
|
9248
9248
|
this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
|
|
9249
9249
|
}
|
|
9250
9250
|
};
|
|
@@ -13140,9 +13140,13 @@ var InteractVFXItem = /** @class */ (function (_super) {
|
|
|
13140
13140
|
this.handleDragMove(this.dragEvent, this.bouncingArg);
|
|
13141
13141
|
}
|
|
13142
13142
|
};
|
|
13143
|
-
InteractVFXItem.prototype.
|
|
13143
|
+
InteractVFXItem.prototype.onEnd = function () {
|
|
13144
|
+
if (this.composition) {
|
|
13145
|
+
this.composition.removeInteractiveItem(this, this.ui.options.type);
|
|
13146
|
+
}
|
|
13147
|
+
};
|
|
13148
|
+
InteractVFXItem.prototype.onItemRemoved = function () {
|
|
13144
13149
|
var _a;
|
|
13145
|
-
composition.removeInteractiveItem(this, this.ui.options.type);
|
|
13146
13150
|
this.clickable = false;
|
|
13147
13151
|
(_a = this.previewContent) === null || _a === void 0 ? void 0 : _a.mesh.dispose();
|
|
13148
13152
|
this.endDragTarget();
|
|
@@ -21350,8 +21354,9 @@ var Camera = /** @class */ (function () {
|
|
|
21350
21354
|
Camera.prototype.getInverseVPRatio = function (z) {
|
|
21351
21355
|
var pos = new Vector3(0, 0, z);
|
|
21352
21356
|
var mat = this.getViewProjectionMatrix();
|
|
21353
|
-
var
|
|
21354
|
-
|
|
21357
|
+
var inverseVP = this.getInverseViewProjectionMatrix();
|
|
21358
|
+
var nz = mat.projectPoint(pos).z;
|
|
21359
|
+
return inverseVP.projectPoint(new Vector3(1, 1, nz));
|
|
21355
21360
|
};
|
|
21356
21361
|
/**
|
|
21357
21362
|
* 设置相机的旋转四元数
|
|
@@ -21363,7 +21368,6 @@ var Camera = /** @class */ (function () {
|
|
|
21363
21368
|
this.dirty = true;
|
|
21364
21369
|
}
|
|
21365
21370
|
else {
|
|
21366
|
-
this.options.quat;
|
|
21367
21371
|
if (!this.options.quat.equals(value)) {
|
|
21368
21372
|
this.options.quat.copyFrom(value);
|
|
21369
21373
|
this.dirty = true;
|
|
@@ -23695,16 +23699,17 @@ var AssetManager = /** @class */ (function () {
|
|
|
23695
23699
|
};
|
|
23696
23700
|
AssetManager.prototype.processBins = function (bins) {
|
|
23697
23701
|
return __awaiter(this, void 0, void 0, function () {
|
|
23698
|
-
var renderLevel, jobs;
|
|
23702
|
+
var renderLevel, baseUrl, jobs;
|
|
23699
23703
|
var _this = this;
|
|
23700
23704
|
return __generator(this, function (_a) {
|
|
23701
23705
|
renderLevel = this.options.renderLevel;
|
|
23706
|
+
baseUrl = this.baseUrl;
|
|
23702
23707
|
jobs = bins.map(function (bin) {
|
|
23703
23708
|
if (bin instanceof ArrayBuffer) {
|
|
23704
23709
|
return bin;
|
|
23705
23710
|
}
|
|
23706
23711
|
if (passRenderLevel(bin.renderLevel, renderLevel)) {
|
|
23707
|
-
return _this.loadBins(bin.url);
|
|
23712
|
+
return _this.loadBins(new weapp.URL(bin.url, baseUrl).href);
|
|
23708
23713
|
}
|
|
23709
23714
|
throw new Error("Invalid bins source: ".concat(JSON.stringify(bins)));
|
|
23710
23715
|
});
|
|
@@ -23722,13 +23727,14 @@ var AssetManager = /** @class */ (function () {
|
|
|
23722
23727
|
return [2 /*return*/];
|
|
23723
23728
|
}
|
|
23724
23729
|
jobs = fonts.map(function (font) { return __awaiter(_this, void 0, void 0, function () {
|
|
23725
|
-
var fontFace;
|
|
23730
|
+
var url, fontFace;
|
|
23726
23731
|
var _a;
|
|
23727
23732
|
return __generator(this, function (_b) {
|
|
23728
23733
|
switch (_b.label) {
|
|
23729
23734
|
case 0:
|
|
23730
23735
|
if (!(font.fontURL && !AssetManager.fonts.has(font.fontFamily))) return [3 /*break*/, 4];
|
|
23731
|
-
|
|
23736
|
+
url = new weapp.URL(font.fontURL, this.baseUrl).href;
|
|
23737
|
+
fontFace = new FontFace((_a = font.fontFamily) !== null && _a !== void 0 ? _a : '', 'url(' + url + ')');
|
|
23732
23738
|
_b.label = 1;
|
|
23733
23739
|
case 1:
|
|
23734
23740
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23741,7 +23747,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23741
23747
|
return [3 /*break*/, 4];
|
|
23742
23748
|
case 3:
|
|
23743
23749
|
_b.sent();
|
|
23744
|
-
logger.warn("Invalid fonts source: ".concat(JSON.stringify(
|
|
23750
|
+
logger.warn("Invalid fonts source: ".concat(JSON.stringify(url)));
|
|
23745
23751
|
return [3 /*break*/, 4];
|
|
23746
23752
|
case 4: return [2 /*return*/];
|
|
23747
23753
|
}
|
|
@@ -23973,7 +23979,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
23973
23979
|
return image.source;
|
|
23974
23980
|
}
|
|
23975
23981
|
else if (image instanceof weapp.HTMLImageElement ||
|
|
23976
|
-
image
|
|
23982
|
+
isCanvas(image)) {
|
|
23977
23983
|
return {
|
|
23978
23984
|
image: image,
|
|
23979
23985
|
sourceType: exports.TextureSourceType.image,
|
|
@@ -24010,6 +24016,11 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
24010
24016
|
}
|
|
24011
24017
|
throw new Error('Invalid texture options');
|
|
24012
24018
|
}
|
|
24019
|
+
function isCanvas(cavnas) {
|
|
24020
|
+
var _a;
|
|
24021
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
24022
|
+
return typeof cavnas === 'object' && cavnas !== null && ((_a = cavnas.tagName) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'CANVAS';
|
|
24023
|
+
}
|
|
24013
24024
|
|
|
24014
24025
|
var CompVFXItem = /** @class */ (function (_super) {
|
|
24015
24026
|
__extends(CompVFXItem, _super);
|
|
@@ -29593,6 +29604,7 @@ var Player = /** @class */ (function () {
|
|
|
29593
29604
|
this.displayScale = 1;
|
|
29594
29605
|
this.resumePending = false;
|
|
29595
29606
|
this.disposed = false;
|
|
29607
|
+
this.assetManagers = [];
|
|
29596
29608
|
this.speed = 1;
|
|
29597
29609
|
this.baseCompositionIndex = 0;
|
|
29598
29610
|
/**
|
|
@@ -29875,7 +29887,7 @@ var Player = /** @class */ (function () {
|
|
|
29875
29887
|
Player.prototype.createComposition = function (url, options) {
|
|
29876
29888
|
if (options === void 0) { options = {}; }
|
|
29877
29889
|
return __awaiter(this, void 0, void 0, function () {
|
|
29878
|
-
var renderer, last, opts, source, scene, composition, firstFrameTime;
|
|
29890
|
+
var renderer, last, opts, source, assetManager, scene, composition, firstFrameTime;
|
|
29879
29891
|
var _this = this;
|
|
29880
29892
|
return __generator(this, function (_a) {
|
|
29881
29893
|
switch (_a.label) {
|
|
@@ -29890,13 +29902,9 @@ var Player = /** @class */ (function () {
|
|
|
29890
29902
|
else {
|
|
29891
29903
|
source = url;
|
|
29892
29904
|
}
|
|
29893
|
-
|
|
29894
|
-
|
|
29895
|
-
}
|
|
29896
|
-
else {
|
|
29897
|
-
this.assetManager = new AssetManager(opts);
|
|
29898
|
-
}
|
|
29899
|
-
return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
29905
|
+
assetManager = new AssetManager(opts);
|
|
29906
|
+
this.assetManagers.push(assetManager);
|
|
29907
|
+
return [4 /*yield*/, assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
29900
29908
|
case 1:
|
|
29901
29909
|
scene = _a.sent();
|
|
29902
29910
|
// 加载期间 player 销毁
|
|
@@ -30226,7 +30234,7 @@ var Player = /** @class */ (function () {
|
|
|
30226
30234
|
* @param keepCanvas - 是否保留 canvas 画面,默认不保留,canvas 不能再被使用
|
|
30227
30235
|
*/
|
|
30228
30236
|
Player.prototype.dispose = function (keepCanvas) {
|
|
30229
|
-
var _a
|
|
30237
|
+
var _a;
|
|
30230
30238
|
logger.info("call player destroy: ".concat(this.name));
|
|
30231
30239
|
if (this.disposed) {
|
|
30232
30240
|
return;
|
|
@@ -30234,7 +30242,7 @@ var Player = /** @class */ (function () {
|
|
|
30234
30242
|
playerMap.delete(this.canvas);
|
|
30235
30243
|
this.pause();
|
|
30236
30244
|
(_a = this.ticker) === null || _a === void 0 ? void 0 : _a.stop();
|
|
30237
|
-
(
|
|
30245
|
+
this.assetManagers.forEach(function (assetManager) { return assetManager.dispose(); });
|
|
30238
30246
|
this.compositions.forEach(function (comp) { return comp.dispose(); });
|
|
30239
30247
|
this.compositions.length = 0;
|
|
30240
30248
|
this.renderer.context.removeLostHandler({ lost: this.lost });
|
|
@@ -30440,7 +30448,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
30440
30448
|
Engine.create = function (gl) {
|
|
30441
30449
|
return new GLEngine(gl);
|
|
30442
30450
|
};
|
|
30443
|
-
var version = "1.2.
|
|
30451
|
+
var version = "1.2.5";
|
|
30444
30452
|
logger.info('player version: ' + version);
|
|
30445
30453
|
|
|
30446
30454
|
exports.AbstractPlugin = AbstractPlugin;
|