@galacean/effects-threejs 1.3.0-alpha.0 → 1.3.0-alpha.1
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 +32 -20
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +32 -20
- 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.3.0-alpha.
|
|
6
|
+
* Version: v1.3.0-alpha.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -708,7 +708,7 @@ function asserts(condition, msg) {
|
|
|
708
708
|
* Name: @galacean/effects-specification
|
|
709
709
|
* Description: Galacean Effects JSON Specification
|
|
710
710
|
* Author: Ant Group CO., Ltd.
|
|
711
|
-
* Version: v1.1.0-alpha.
|
|
711
|
+
* Version: v1.1.0-alpha.1
|
|
712
712
|
*/
|
|
713
713
|
|
|
714
714
|
/*********************************************/
|
|
@@ -9280,10 +9280,10 @@ var VFXItem = /** @class */ (function () {
|
|
|
9280
9280
|
};
|
|
9281
9281
|
VFXItem.prototype.translateByPixel = function (x, y) {
|
|
9282
9282
|
if (this.composition) {
|
|
9283
|
+
// @ts-expect-error
|
|
9284
|
+
var _a = this.composition.renderer.canvas.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
9283
9285
|
var z = this.transform.getWorldPosition().z;
|
|
9284
|
-
var
|
|
9285
|
-
var width = this.composition.renderer.getWidth() / 2;
|
|
9286
|
-
var height = this.composition.renderer.getHeight() / 2;
|
|
9286
|
+
var _b = this.composition.camera.getInverseVPRatio(z), rx = _b.x, ry = _b.y;
|
|
9287
9287
|
this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
|
|
9288
9288
|
}
|
|
9289
9289
|
};
|
|
@@ -13174,9 +13174,13 @@ var InteractVFXItem = /** @class */ (function (_super) {
|
|
|
13174
13174
|
this.handleDragMove(this.dragEvent, this.bouncingArg);
|
|
13175
13175
|
}
|
|
13176
13176
|
};
|
|
13177
|
-
InteractVFXItem.prototype.
|
|
13177
|
+
InteractVFXItem.prototype.onEnd = function () {
|
|
13178
|
+
if (this.composition) {
|
|
13179
|
+
this.composition.removeInteractiveItem(this, this.ui.options.type);
|
|
13180
|
+
}
|
|
13181
|
+
};
|
|
13182
|
+
InteractVFXItem.prototype.onItemRemoved = function () {
|
|
13178
13183
|
var _a;
|
|
13179
|
-
composition.removeInteractiveItem(this, this.ui.options.type);
|
|
13180
13184
|
this.clickable = false;
|
|
13181
13185
|
(_a = this.previewContent) === null || _a === void 0 ? void 0 : _a.mesh.dispose();
|
|
13182
13186
|
this.endDragTarget();
|
|
@@ -14968,7 +14972,6 @@ var SpriteItem = /** @class */ (function (_super) {
|
|
|
14968
14972
|
ret.texOffset = [0, 0, 1, 1];
|
|
14969
14973
|
}
|
|
14970
14974
|
ret.visible = this.vfxItem.contentVisible;
|
|
14971
|
-
// 图层元素作为父节点时,除了k的大小变换,自身的尺寸也需要传递给子元素,子元素可以通过startSize读取
|
|
14972
14975
|
ret.startSize = this.startSize;
|
|
14973
14976
|
return ret;
|
|
14974
14977
|
};
|
|
@@ -15066,7 +15069,9 @@ var SpriteVFXItem = /** @class */ (function (_super) {
|
|
|
15066
15069
|
};
|
|
15067
15070
|
SpriteVFXItem.prototype.doCreateContent = function (composition) {
|
|
15068
15071
|
var emptyTexture = composition.getRendererOptions().emptyTexture;
|
|
15069
|
-
|
|
15072
|
+
var content = new SpriteItem(this.sprite, { emptyTexture: emptyTexture }, this);
|
|
15073
|
+
content.getRenderData(0, true);
|
|
15074
|
+
return content;
|
|
15070
15075
|
};
|
|
15071
15076
|
SpriteVFXItem.prototype.createWireframeMesh = function (item, color) {
|
|
15072
15077
|
var spMesh = new SpriteMesh(this.composition.getEngine(), __assign$1({ wireframe: true }, item.renderInfo), this.composition);
|
|
@@ -21404,8 +21409,9 @@ var Camera = /** @class */ (function () {
|
|
|
21404
21409
|
Camera.prototype.getInverseVPRatio = function (z) {
|
|
21405
21410
|
var pos = new Vector3(0, 0, z);
|
|
21406
21411
|
var mat = this.getViewProjectionMatrix();
|
|
21407
|
-
var
|
|
21408
|
-
|
|
21412
|
+
var inverseVP = this.getInverseViewProjectionMatrix();
|
|
21413
|
+
var nz = mat.projectPoint(pos).z;
|
|
21414
|
+
return inverseVP.projectPoint(new Vector3(1, 1, nz));
|
|
21409
21415
|
};
|
|
21410
21416
|
/**
|
|
21411
21417
|
* 设置相机的旋转四元数
|
|
@@ -21417,7 +21423,6 @@ var Camera = /** @class */ (function () {
|
|
|
21417
21423
|
this.dirty = true;
|
|
21418
21424
|
}
|
|
21419
21425
|
else {
|
|
21420
|
-
this.options.quat;
|
|
21421
21426
|
if (!this.options.quat.equals(value)) {
|
|
21422
21427
|
this.options.quat.copyFrom(value);
|
|
21423
21428
|
this.dirty = true;
|
|
@@ -21594,7 +21599,7 @@ var filters = {
|
|
|
21594
21599
|
* Name: @galacean/effects-specification
|
|
21595
21600
|
* Description: Galacean Effects JSON Specification
|
|
21596
21601
|
* Author: Ant Group CO., Ltd.
|
|
21597
|
-
* Version: v1.1.0-alpha.
|
|
21602
|
+
* Version: v1.1.0-alpha.1
|
|
21598
21603
|
*/
|
|
21599
21604
|
|
|
21600
21605
|
/*********************************************/
|
|
@@ -23757,16 +23762,17 @@ var AssetManager = /** @class */ (function () {
|
|
|
23757
23762
|
};
|
|
23758
23763
|
AssetManager.prototype.processBins = function (bins) {
|
|
23759
23764
|
return __awaiter(this, void 0, void 0, function () {
|
|
23760
|
-
var renderLevel, jobs;
|
|
23765
|
+
var renderLevel, baseUrl, jobs;
|
|
23761
23766
|
var _this = this;
|
|
23762
23767
|
return __generator(this, function (_a) {
|
|
23763
23768
|
renderLevel = this.options.renderLevel;
|
|
23769
|
+
baseUrl = this.baseUrl;
|
|
23764
23770
|
jobs = bins.map(function (bin) {
|
|
23765
23771
|
if (bin instanceof ArrayBuffer) {
|
|
23766
23772
|
return bin;
|
|
23767
23773
|
}
|
|
23768
23774
|
if (passRenderLevel(bin.renderLevel, renderLevel)) {
|
|
23769
|
-
return _this.loadBins(bin.url);
|
|
23775
|
+
return _this.loadBins(new URL(bin.url, baseUrl).href);
|
|
23770
23776
|
}
|
|
23771
23777
|
throw new Error("Invalid bins source: ".concat(JSON.stringify(bins)));
|
|
23772
23778
|
});
|
|
@@ -23784,13 +23790,14 @@ var AssetManager = /** @class */ (function () {
|
|
|
23784
23790
|
return [2 /*return*/];
|
|
23785
23791
|
}
|
|
23786
23792
|
jobs = fonts.map(function (font) { return __awaiter(_this, void 0, void 0, function () {
|
|
23787
|
-
var fontFace;
|
|
23793
|
+
var url, fontFace;
|
|
23788
23794
|
var _a;
|
|
23789
23795
|
return __generator(this, function (_b) {
|
|
23790
23796
|
switch (_b.label) {
|
|
23791
23797
|
case 0:
|
|
23792
23798
|
if (!(font.fontURL && !AssetManager.fonts.has(font.fontFamily))) return [3 /*break*/, 4];
|
|
23793
|
-
|
|
23799
|
+
url = new URL(font.fontURL, this.baseUrl).href;
|
|
23800
|
+
fontFace = new FontFace((_a = font.fontFamily) !== null && _a !== void 0 ? _a : '', 'url(' + url + ')');
|
|
23794
23801
|
_b.label = 1;
|
|
23795
23802
|
case 1:
|
|
23796
23803
|
_b.trys.push([1, 3, , 4]);
|
|
@@ -23803,7 +23810,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23803
23810
|
return [3 /*break*/, 4];
|
|
23804
23811
|
case 3:
|
|
23805
23812
|
_b.sent();
|
|
23806
|
-
logger.warn("Invalid fonts source: ".concat(JSON.stringify(
|
|
23813
|
+
logger.warn("Invalid fonts source: ".concat(JSON.stringify(url)));
|
|
23807
23814
|
return [3 /*break*/, 4];
|
|
23808
23815
|
case 4: return [2 /*return*/];
|
|
23809
23816
|
}
|
|
@@ -24016,7 +24023,7 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
24016
24023
|
return image.source;
|
|
24017
24024
|
}
|
|
24018
24025
|
else if (image instanceof HTMLImageElement ||
|
|
24019
|
-
image
|
|
24026
|
+
isCanvas(image)) {
|
|
24020
24027
|
return {
|
|
24021
24028
|
image: image,
|
|
24022
24029
|
sourceType: exports.TextureSourceType.image,
|
|
@@ -24053,6 +24060,11 @@ function createTextureOptionsBySource(image, sourceFrom) {
|
|
|
24053
24060
|
}
|
|
24054
24061
|
throw new Error('Invalid texture options');
|
|
24055
24062
|
}
|
|
24063
|
+
function isCanvas(canvas) {
|
|
24064
|
+
var _a;
|
|
24065
|
+
// 小程序 Canvas 无法使用 instanceof HTMLCanvasElement 判断
|
|
24066
|
+
return typeof canvas === 'object' && canvas !== null && ((_a = canvas.tagName) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'CANVAS';
|
|
24067
|
+
}
|
|
24056
24068
|
|
|
24057
24069
|
var CompVFXItem = /** @class */ (function (_super) {
|
|
24058
24070
|
__extends(CompVFXItem, _super);
|
|
@@ -26950,7 +26962,7 @@ Geometry.create = function (engine, options) {
|
|
|
26950
26962
|
Mesh.create = function (engine, props) {
|
|
26951
26963
|
return new ThreeMesh(engine, props);
|
|
26952
26964
|
};
|
|
26953
|
-
var version = "1.3.0-alpha.
|
|
26965
|
+
var version = "1.3.0-alpha.1";
|
|
26954
26966
|
logger.info('THREEJS plugin version: ' + version);
|
|
26955
26967
|
|
|
26956
26968
|
exports.AbstractPlugin = AbstractPlugin;
|