@galacean/effects-threejs 2.3.0 → 2.3.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 +51 -34
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +51 -34
- 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: v2.3.
|
|
6
|
+
* Version: v2.3.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -952,10 +952,10 @@ var PluginSystem = /*#__PURE__*/ function() {
|
|
|
952
952
|
});
|
|
953
953
|
})();
|
|
954
954
|
};
|
|
955
|
-
_proto.precompile = function precompile(compositions, renderer
|
|
955
|
+
_proto.precompile = function precompile(compositions, renderer) {
|
|
956
956
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.plugins), _step; !(_step = _iterator()).done;){
|
|
957
957
|
var plugin = _step.value;
|
|
958
|
-
plugin.precompile(compositions, renderer
|
|
958
|
+
plugin.precompile(compositions, renderer);
|
|
959
959
|
}
|
|
960
960
|
};
|
|
961
961
|
_proto.loadResources = function loadResources(scene, options) {
|
|
@@ -1030,7 +1030,7 @@ function getPluginUsageInfo(name) {
|
|
|
1030
1030
|
* 在加载到 JSON 后,就可以进行提前编译
|
|
1031
1031
|
* @param json
|
|
1032
1032
|
* @param player
|
|
1033
|
-
*/ _proto.precompile = function precompile(compositions, renderer
|
|
1033
|
+
*/ _proto.precompile = function precompile(compositions, renderer) {};
|
|
1034
1034
|
_proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {};
|
|
1035
1035
|
_proto.onCompositionItemLifeBegin = function onCompositionItemLifeBegin(composition, item) {};
|
|
1036
1036
|
_proto.onCompositionItemLifeEnd = function onCompositionItemLifeEnd(composition, item) {};
|
|
@@ -16349,7 +16349,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16349
16349
|
_this.hasFill = false;
|
|
16350
16350
|
_this.shapeDirty = true;
|
|
16351
16351
|
_this.graphicsPath = new GraphicsPath();
|
|
16352
|
-
_this.curveValues = [];
|
|
16353
16352
|
_this.vert = "\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n";
|
|
16354
16353
|
_this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n";
|
|
16355
16354
|
if (!_this.geometry) {
|
|
@@ -16531,31 +16530,25 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16531
16530
|
var easingOuts = customShapeAtribute.easingOuts;
|
|
16532
16531
|
for(var _iterator = _create_for_of_iterator_helper_loose(customShapeAtribute.shapes), _step; !(_step = _iterator()).done;){
|
|
16533
16532
|
var shape = _step.value;
|
|
16534
|
-
this.curveValues = [];
|
|
16535
16533
|
var indices = shape.indexes;
|
|
16534
|
+
var startPoint = points[indices[0].point];
|
|
16535
|
+
this.graphicsPath.moveTo(startPoint.x, startPoint.y);
|
|
16536
16536
|
for(var i = 1; i < indices.length; i++){
|
|
16537
16537
|
var pointIndex = indices[i];
|
|
16538
16538
|
var lastPointIndex = indices[i - 1];
|
|
16539
|
-
|
|
16540
|
-
|
|
16541
|
-
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
}
|
|
16545
|
-
// Push the last curve
|
|
16546
|
-
this.curveValues.push({
|
|
16547
|
-
point: points[indices[0].point],
|
|
16548
|
-
controlPoint1: easingOuts[indices[indices.length - 1].easingOut],
|
|
16549
|
-
controlPoint2: easingIns[indices[0].easingIn]
|
|
16550
|
-
});
|
|
16551
|
-
this.graphicsPath.moveTo(this.curveValues[this.curveValues.length - 1].point.x, this.curveValues[this.curveValues.length - 1].point.y);
|
|
16552
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.curveValues), _step1; !(_step1 = _iterator1()).done;){
|
|
16553
|
-
var curveValue = _step1.value;
|
|
16554
|
-
var point = curveValue.point;
|
|
16555
|
-
var control1 = curveValue.controlPoint1;
|
|
16556
|
-
var control2 = curveValue.controlPoint2;
|
|
16557
|
-
this.graphicsPath.bezierCurveTo(control1.x, control1.y, control2.x, control2.y, point.x, point.y, 1);
|
|
16539
|
+
var point = points[pointIndex.point];
|
|
16540
|
+
var lastPoint = points[lastPointIndex.point];
|
|
16541
|
+
var control1 = easingOuts[lastPointIndex.easingOut];
|
|
16542
|
+
var control2 = easingIns[pointIndex.easingIn];
|
|
16543
|
+
this.graphicsPath.bezierCurveTo(control1.x + lastPoint.x, control1.y + lastPoint.y, control2.x + point.x, control2.y + point.y, point.x, point.y, 1);
|
|
16558
16544
|
}
|
|
16545
|
+
var pointIndex1 = indices[0];
|
|
16546
|
+
var lastPointIndex1 = indices[indices.length - 1];
|
|
16547
|
+
var point1 = points[pointIndex1.point];
|
|
16548
|
+
var lastPoint1 = points[lastPointIndex1.point];
|
|
16549
|
+
var control11 = easingOuts[lastPointIndex1.easingOut];
|
|
16550
|
+
var control21 = easingIns[pointIndex1.easingIn];
|
|
16551
|
+
this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, 1);
|
|
16559
16552
|
if (shape.close) {
|
|
16560
16553
|
this.graphicsPath.closePath();
|
|
16561
16554
|
}
|
|
@@ -26676,14 +26669,36 @@ function getStandardInteractContent(ui) {
|
|
|
26676
26669
|
// @ts-expect-error
|
|
26677
26670
|
customShapeComponent.fill = customShapeComponent.shapes[0].fill;
|
|
26678
26671
|
}
|
|
26672
|
+
// easingIn 和 easingOut 绝对坐标转相对坐标
|
|
26673
|
+
var easingInFlag = new Array(customShapeComponent.easingIns.length);
|
|
26674
|
+
var easingOutFlag = new Array(customShapeComponent.easingOuts.length).fill(false);
|
|
26675
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(customShapeComponent.shapes), _step1; !(_step1 = _iterator1()).done;){
|
|
26676
|
+
var shape = _step1.value;
|
|
26677
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(shape.indexes), _step2; !(_step2 = _iterator2()).done;){
|
|
26678
|
+
var index = _step2.value;
|
|
26679
|
+
var point = customShapeComponent.points[index.point];
|
|
26680
|
+
var easingIn = customShapeComponent.easingIns[index.easingIn];
|
|
26681
|
+
var easingOut = customShapeComponent.easingOuts[index.easingOut];
|
|
26682
|
+
if (!easingInFlag[index.easingIn]) {
|
|
26683
|
+
easingIn.x -= point.x;
|
|
26684
|
+
easingIn.y -= point.y;
|
|
26685
|
+
easingInFlag[index.easingIn] = true;
|
|
26686
|
+
}
|
|
26687
|
+
if (!easingOutFlag[index.easingOut]) {
|
|
26688
|
+
easingOut.x -= point.x;
|
|
26689
|
+
easingOut.y -= point.y;
|
|
26690
|
+
easingOutFlag[index.easingOut] = true;
|
|
26691
|
+
}
|
|
26692
|
+
}
|
|
26693
|
+
}
|
|
26679
26694
|
}
|
|
26680
26695
|
}
|
|
26681
26696
|
}
|
|
26682
26697
|
// Composition id 转 guid
|
|
26683
26698
|
var compositionId = json.compositionId;
|
|
26684
26699
|
var compositionIdToGUIDMap = {};
|
|
26685
|
-
for(var
|
|
26686
|
-
var composition =
|
|
26700
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
|
|
26701
|
+
var composition = _step3.value;
|
|
26687
26702
|
var guid = generateGUID();
|
|
26688
26703
|
compositionIdToGUIDMap[composition.id] = guid;
|
|
26689
26704
|
if (composition.id === compositionId) {
|
|
@@ -26692,8 +26707,8 @@ function getStandardInteractContent(ui) {
|
|
|
26692
26707
|
composition.id = guid;
|
|
26693
26708
|
}
|
|
26694
26709
|
// 预合成元素 refId 同步改为生成的合成 guid
|
|
26695
|
-
for(var
|
|
26696
|
-
var item =
|
|
26710
|
+
for(var _iterator4 = _create_for_of_iterator_helper_loose(json.items), _step4; !(_step4 = _iterator4()).done;){
|
|
26711
|
+
var item = _step4.value;
|
|
26697
26712
|
if (item.content) {
|
|
26698
26713
|
var compositionOptions = item.content.options;
|
|
26699
26714
|
if (compositionOptions && compositionOptions.refId !== undefined) {
|
|
@@ -27547,8 +27562,10 @@ function getStandardJSON(json) {
|
|
|
27547
27562
|
json = version30Migration(version21Migration(json));
|
|
27548
27563
|
}
|
|
27549
27564
|
// 3.x 版本格式转换
|
|
27550
|
-
if (mainVersion < 4
|
|
27551
|
-
|
|
27565
|
+
if (mainVersion < 4) {
|
|
27566
|
+
if (mainVersion === 3 && minorVersion < 2) {
|
|
27567
|
+
json = version31Migration(json);
|
|
27568
|
+
}
|
|
27552
27569
|
}
|
|
27553
27570
|
return json;
|
|
27554
27571
|
}
|
|
@@ -32101,7 +32118,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
|
|
|
32101
32118
|
registerPlugin("particle", ParticleLoader, exports.VFXItem);
|
|
32102
32119
|
registerPlugin("cal", CalculateLoader, exports.VFXItem);
|
|
32103
32120
|
registerPlugin("interact", InteractLoader, exports.VFXItem);
|
|
32104
|
-
var version$1 = "2.3.
|
|
32121
|
+
var version$1 = "2.3.1";
|
|
32105
32122
|
logger.info("Core version: " + version$1 + ".");
|
|
32106
32123
|
|
|
32107
32124
|
var _obj;
|
|
@@ -33408,7 +33425,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
33408
33425
|
_this.assetService.prepareAssets(_$scene, assetManager.getAssets());
|
|
33409
33426
|
_this.assetService.updateTextVariables(_$scene, assetManager.options.variables);
|
|
33410
33427
|
_this.assetService.initializeTexture(_$scene);
|
|
33411
|
-
_$scene.pluginSystem.precompile(_$scene.jsonScene.compositions, _this.renderer
|
|
33428
|
+
_$scene.pluginSystem.precompile(_$scene.jsonScene.compositions, _this.renderer);
|
|
33412
33429
|
composition = _this.createComposition(_$scene, opts);
|
|
33413
33430
|
_this.baseCompositionIndex += 1;
|
|
33414
33431
|
composition.setIndex(baseOrder + index);
|
|
@@ -33701,7 +33718,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
33701
33718
|
*/ Mesh.create = function(engine, props) {
|
|
33702
33719
|
return new ThreeMesh(engine, props);
|
|
33703
33720
|
};
|
|
33704
|
-
var version = "2.3.
|
|
33721
|
+
var version = "2.3.1";
|
|
33705
33722
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
33706
33723
|
|
|
33707
33724
|
exports.AbstractPlugin = AbstractPlugin;
|