@galacean/effects-threejs 1.1.0-alpha.0 → 1.1.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 +81 -78
- 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 +81 -78
- 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.0-alpha.
|
|
6
|
+
* Version: v1.1.0-alpha.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -19179,7 +19179,7 @@ var InteractVFXItem = /** @class */ (function (_super) {
|
|
|
19179
19179
|
(_b = event.origin) === null || _b === void 0 ? void 0 : _b.preventDefault();
|
|
19180
19180
|
}
|
|
19181
19181
|
}
|
|
19182
|
-
this.composition.camera.position
|
|
19182
|
+
this.composition.camera.position = new Vector3(nx, ny, depth);
|
|
19183
19183
|
};
|
|
19184
19184
|
return InteractVFXItem;
|
|
19185
19185
|
}(VFXItem));
|
|
@@ -29896,7 +29896,8 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
29896
29896
|
configurable: true
|
|
29897
29897
|
});
|
|
29898
29898
|
CompVFXItem.prototype.onConstructed = function (props) {
|
|
29899
|
-
var _a = props.items, items = _a === void 0 ? [] : _a, _b = props.startTime, startTime = _b === void 0 ? 0 : _b, content = props.content;
|
|
29899
|
+
var _a = props.items, items = _a === void 0 ? [] : _a, _b = props.startTime, startTime = _b === void 0 ? 0 : _b, content = props.content, refId = props.refId;
|
|
29900
|
+
this.refId = refId;
|
|
29900
29901
|
this.itemProps = items;
|
|
29901
29902
|
this.contentProps = content;
|
|
29902
29903
|
var endBehavior = this.endBehavior;
|
|
@@ -29923,13 +29924,8 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
29923
29924
|
if (!props) {
|
|
29924
29925
|
throw new Error("\u5F15\u7528\u7684Id: ".concat(refId, " \u7684\u9884\u5408\u6210\u4E0D\u5B58\u5728"));
|
|
29925
29926
|
}
|
|
29926
|
-
props.name = itemProps.name;
|
|
29927
|
-
props.duration = itemProps.duration;
|
|
29928
|
-
props.endBehavior = itemProps.endBehavior;
|
|
29929
|
-
props.delay = itemProps.delay;
|
|
29930
|
-
props.parentId = itemProps.parentId;
|
|
29931
29927
|
props.content = itemProps.content;
|
|
29932
|
-
item = new CompVFXItem(props, this.composition);
|
|
29928
|
+
item = new CompVFXItem(__assign$1(__assign$1({}, props), { refId: refId, id: itemProps.id, name: itemProps.name, duration: itemProps.duration, endBehavior: itemProps.endBehavior, parentId: itemProps.parentId, transform: itemProps.transform }), this.composition);
|
|
29933
29929
|
item.contentProps = itemProps.content;
|
|
29934
29930
|
item.transform.parentTransform = this.transform;
|
|
29935
29931
|
this.composition.refContent.push(item);
|
|
@@ -30184,6 +30180,74 @@ var CompVFXItem = /** @class */ (function (_super) {
|
|
|
30184
30180
|
}
|
|
30185
30181
|
return res;
|
|
30186
30182
|
};
|
|
30183
|
+
CompVFXItem.prototype.hitTest = function (ray, x, y, regions, force, options) {
|
|
30184
|
+
var hitPositions = [];
|
|
30185
|
+
var stop = (options === null || options === void 0 ? void 0 : options.stop) || noop;
|
|
30186
|
+
var skip = (options === null || options === void 0 ? void 0 : options.skip) || noop;
|
|
30187
|
+
var maxCount = (options === null || options === void 0 ? void 0 : options.maxCount) || this.items.length;
|
|
30188
|
+
for (var i = 0; i < this.items.length && regions.length < maxCount; i++) {
|
|
30189
|
+
var item = this.items[i];
|
|
30190
|
+
if (item.lifetime >= 0 && item.lifetime <= 1 && !VFXItem.isComposition(item) && !skip(item)) {
|
|
30191
|
+
var hitParams = item.getHitTestParams(force);
|
|
30192
|
+
if (hitParams) {
|
|
30193
|
+
var success = false;
|
|
30194
|
+
var intersectPoint = new Vector3();
|
|
30195
|
+
if (hitParams.type === HitTestType.triangle) {
|
|
30196
|
+
var triangles = hitParams.triangles, backfaceCulling = hitParams.backfaceCulling;
|
|
30197
|
+
for (var j = 0; j < triangles.length; j++) {
|
|
30198
|
+
var triangle = triangles[j];
|
|
30199
|
+
if (ray.intersectTriangle(triangle, intersectPoint, backfaceCulling)) {
|
|
30200
|
+
success = true;
|
|
30201
|
+
hitPositions.push(intersectPoint);
|
|
30202
|
+
break;
|
|
30203
|
+
}
|
|
30204
|
+
}
|
|
30205
|
+
}
|
|
30206
|
+
else if (hitParams.type === HitTestType.box) {
|
|
30207
|
+
var center = hitParams.center, size = hitParams.size;
|
|
30208
|
+
var boxMin = center.clone().addScaledVector(size, 0.5);
|
|
30209
|
+
var boxMax = center.clone().addScaledVector(size, -0.5);
|
|
30210
|
+
if (ray.intersectBox({ min: boxMin, max: boxMax }, intersectPoint)) {
|
|
30211
|
+
success = true;
|
|
30212
|
+
hitPositions.push(intersectPoint);
|
|
30213
|
+
}
|
|
30214
|
+
}
|
|
30215
|
+
else if (hitParams.type === HitTestType.sphere) {
|
|
30216
|
+
var center = hitParams.center, radius = hitParams.radius;
|
|
30217
|
+
if (ray.intersectSphere({ center: center, radius: radius }, intersectPoint)) {
|
|
30218
|
+
success = true;
|
|
30219
|
+
hitPositions.push(intersectPoint);
|
|
30220
|
+
}
|
|
30221
|
+
}
|
|
30222
|
+
else if (hitParams.type === HitTestType.custom) {
|
|
30223
|
+
var tempPosition = hitParams.collect(ray, new Vector2(x, y));
|
|
30224
|
+
if (tempPosition && tempPosition.length > 0) {
|
|
30225
|
+
tempPosition.forEach(function (pos) {
|
|
30226
|
+
hitPositions.push(pos);
|
|
30227
|
+
});
|
|
30228
|
+
success = true;
|
|
30229
|
+
}
|
|
30230
|
+
}
|
|
30231
|
+
if (success) {
|
|
30232
|
+
var region = {
|
|
30233
|
+
compContent: this,
|
|
30234
|
+
id: item.id,
|
|
30235
|
+
name: item.name,
|
|
30236
|
+
position: hitPositions[hitPositions.length - 1],
|
|
30237
|
+
parentId: item.parentId,
|
|
30238
|
+
hitPositions: hitPositions,
|
|
30239
|
+
behavior: hitParams.behavior,
|
|
30240
|
+
};
|
|
30241
|
+
regions.push(region);
|
|
30242
|
+
if (stop(region)) {
|
|
30243
|
+
return regions;
|
|
30244
|
+
}
|
|
30245
|
+
}
|
|
30246
|
+
}
|
|
30247
|
+
}
|
|
30248
|
+
}
|
|
30249
|
+
return regions;
|
|
30250
|
+
};
|
|
30187
30251
|
CompVFXItem.prototype.isEnded = function (now) {
|
|
30188
30252
|
return now >= this.durInms;
|
|
30189
30253
|
};
|
|
@@ -30647,7 +30711,7 @@ var Composition = /** @class */ (function () {
|
|
|
30647
30711
|
this.pluginSystem.plugins.forEach(func);
|
|
30648
30712
|
};
|
|
30649
30713
|
/**
|
|
30650
|
-
*
|
|
30714
|
+
* 获取指定位置和相机连成的射线
|
|
30651
30715
|
* @param x
|
|
30652
30716
|
* @param y
|
|
30653
30717
|
* @returns
|
|
@@ -30675,73 +30739,12 @@ var Composition = /** @class */ (function () {
|
|
|
30675
30739
|
if (this.isDestroyed) {
|
|
30676
30740
|
return [];
|
|
30677
30741
|
}
|
|
30678
|
-
var hitPositions = [];
|
|
30679
30742
|
var regions = [];
|
|
30680
|
-
var
|
|
30681
|
-
|
|
30682
|
-
|
|
30683
|
-
|
|
30684
|
-
|
|
30685
|
-
for (var i = 0; i < this.items.length && regions.length < maxCount; i++) {
|
|
30686
|
-
var item = this.items[i];
|
|
30687
|
-
if (item.lifetime >= 0 && item.lifetime <= 1 && !skip(item)) {
|
|
30688
|
-
var hitParams = item.getHitTestParams(force);
|
|
30689
|
-
if (hitParams) {
|
|
30690
|
-
var success = false;
|
|
30691
|
-
var intersectPoint = new Vector3();
|
|
30692
|
-
if (hitParams.type === HitTestType.triangle) {
|
|
30693
|
-
var triangles = hitParams.triangles, backfaceCulling = hitParams.backfaceCulling;
|
|
30694
|
-
for (var j = 0; j < triangles.length; j++) {
|
|
30695
|
-
var triangle = triangles[j];
|
|
30696
|
-
if (ray.intersectTriangle(triangle, intersectPoint, backfaceCulling)) {
|
|
30697
|
-
success = true;
|
|
30698
|
-
hitPositions.push(intersectPoint);
|
|
30699
|
-
break;
|
|
30700
|
-
}
|
|
30701
|
-
}
|
|
30702
|
-
}
|
|
30703
|
-
else if (hitParams.type === HitTestType.box) {
|
|
30704
|
-
var center = hitParams.center, size = hitParams.size;
|
|
30705
|
-
var boxMin = center.clone().addScaledVector(size, 0.5);
|
|
30706
|
-
var boxMax = center.clone().addScaledVector(size, -0.5);
|
|
30707
|
-
if (ray.intersectBox({ min: boxMin, max: boxMax }, intersectPoint)) {
|
|
30708
|
-
success = true;
|
|
30709
|
-
hitPositions.push(intersectPoint);
|
|
30710
|
-
}
|
|
30711
|
-
}
|
|
30712
|
-
else if (hitParams.type === HitTestType.sphere) {
|
|
30713
|
-
var center = hitParams.center, radius = hitParams.radius;
|
|
30714
|
-
if (ray.intersectSphere({ center: center, radius: radius }, intersectPoint)) {
|
|
30715
|
-
success = true;
|
|
30716
|
-
hitPositions.push(intersectPoint);
|
|
30717
|
-
}
|
|
30718
|
-
}
|
|
30719
|
-
else if (hitParams.type === HitTestType.custom) {
|
|
30720
|
-
var tempPosition = hitParams.collect(ray, new Vector2(x, y));
|
|
30721
|
-
if (tempPosition && tempPosition.length > 0) {
|
|
30722
|
-
tempPosition.forEach(function (pos) {
|
|
30723
|
-
hitPositions.push(pos);
|
|
30724
|
-
});
|
|
30725
|
-
success = true;
|
|
30726
|
-
}
|
|
30727
|
-
}
|
|
30728
|
-
if (success) {
|
|
30729
|
-
var region = {
|
|
30730
|
-
id: item.id,
|
|
30731
|
-
name: item.name,
|
|
30732
|
-
position: hitPositions[hitPositions.length - 1],
|
|
30733
|
-
parentId: item.parentId,
|
|
30734
|
-
hitPositions: hitPositions,
|
|
30735
|
-
behavior: hitParams.behavior,
|
|
30736
|
-
};
|
|
30737
|
-
regions.push(region);
|
|
30738
|
-
if (stop(region)) {
|
|
30739
|
-
return regions;
|
|
30740
|
-
}
|
|
30741
|
-
}
|
|
30742
|
-
}
|
|
30743
|
-
}
|
|
30744
|
-
}
|
|
30743
|
+
var ray = this.getHitTestRay(x, y);
|
|
30744
|
+
this.content.hitTest(ray, x, y, regions, force, options);
|
|
30745
|
+
this.refContent.forEach(function (ref) {
|
|
30746
|
+
ref.hitTest(ray, x, y, regions, force, options);
|
|
30747
|
+
});
|
|
30745
30748
|
return regions;
|
|
30746
30749
|
};
|
|
30747
30750
|
/**
|
|
@@ -32712,9 +32715,9 @@ Geometry.create = function (engine, options) {
|
|
|
32712
32715
|
Mesh.create = function (engine, props) {
|
|
32713
32716
|
return new ThreeMesh(engine, props);
|
|
32714
32717
|
};
|
|
32715
|
-
var version = "1.1.0-alpha.
|
|
32718
|
+
var version = "1.1.0-alpha.1";
|
|
32716
32719
|
console.info({
|
|
32717
|
-
content: '[Galacean Effects THREEJS] version: ' + "1.1.0-alpha.
|
|
32720
|
+
content: '[Galacean Effects THREEJS] version: ' + "1.1.0-alpha.1",
|
|
32718
32721
|
type: LOG_TYPE,
|
|
32719
32722
|
});
|
|
32720
32723
|
|