@galacean/effects-threejs 2.3.0 → 2.3.2
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 +55 -35
- 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 +55 -35
- 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.2
|
|
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
|
}
|
|
@@ -17962,6 +17955,7 @@ var seed$4 = 1;
|
|
|
17962
17955
|
this.rotation.y = y;
|
|
17963
17956
|
this.rotation.z = z;
|
|
17964
17957
|
this.quat.setFromEuler(this.rotation);
|
|
17958
|
+
// TODO 修正 GE 四元数旋转共轭问题
|
|
17965
17959
|
this.quat.conjugate();
|
|
17966
17960
|
this.dirtyFlags.localData = true;
|
|
17967
17961
|
this.dispatchValueChange();
|
|
@@ -26676,14 +26670,36 @@ function getStandardInteractContent(ui) {
|
|
|
26676
26670
|
// @ts-expect-error
|
|
26677
26671
|
customShapeComponent.fill = customShapeComponent.shapes[0].fill;
|
|
26678
26672
|
}
|
|
26673
|
+
// easingIn 和 easingOut 绝对坐标转相对坐标
|
|
26674
|
+
var easingInFlag = new Array(customShapeComponent.easingIns.length);
|
|
26675
|
+
var easingOutFlag = new Array(customShapeComponent.easingOuts.length).fill(false);
|
|
26676
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(customShapeComponent.shapes), _step1; !(_step1 = _iterator1()).done;){
|
|
26677
|
+
var shape = _step1.value;
|
|
26678
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(shape.indexes), _step2; !(_step2 = _iterator2()).done;){
|
|
26679
|
+
var index = _step2.value;
|
|
26680
|
+
var point = customShapeComponent.points[index.point];
|
|
26681
|
+
var easingIn = customShapeComponent.easingIns[index.easingIn];
|
|
26682
|
+
var easingOut = customShapeComponent.easingOuts[index.easingOut];
|
|
26683
|
+
if (!easingInFlag[index.easingIn]) {
|
|
26684
|
+
easingIn.x -= point.x;
|
|
26685
|
+
easingIn.y -= point.y;
|
|
26686
|
+
easingInFlag[index.easingIn] = true;
|
|
26687
|
+
}
|
|
26688
|
+
if (!easingOutFlag[index.easingOut]) {
|
|
26689
|
+
easingOut.x -= point.x;
|
|
26690
|
+
easingOut.y -= point.y;
|
|
26691
|
+
easingOutFlag[index.easingOut] = true;
|
|
26692
|
+
}
|
|
26693
|
+
}
|
|
26694
|
+
}
|
|
26679
26695
|
}
|
|
26680
26696
|
}
|
|
26681
26697
|
}
|
|
26682
26698
|
// Composition id 转 guid
|
|
26683
26699
|
var compositionId = json.compositionId;
|
|
26684
26700
|
var compositionIdToGUIDMap = {};
|
|
26685
|
-
for(var
|
|
26686
|
-
var composition =
|
|
26701
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
|
|
26702
|
+
var composition = _step3.value;
|
|
26687
26703
|
var guid = generateGUID();
|
|
26688
26704
|
compositionIdToGUIDMap[composition.id] = guid;
|
|
26689
26705
|
if (composition.id === compositionId) {
|
|
@@ -26692,8 +26708,8 @@ function getStandardInteractContent(ui) {
|
|
|
26692
26708
|
composition.id = guid;
|
|
26693
26709
|
}
|
|
26694
26710
|
// 预合成元素 refId 同步改为生成的合成 guid
|
|
26695
|
-
for(var
|
|
26696
|
-
var item =
|
|
26711
|
+
for(var _iterator4 = _create_for_of_iterator_helper_loose(json.items), _step4; !(_step4 = _iterator4()).done;){
|
|
26712
|
+
var item = _step4.value;
|
|
26697
26713
|
if (item.content) {
|
|
26698
26714
|
var compositionOptions = item.content.options;
|
|
26699
26715
|
if (compositionOptions && compositionOptions.refId !== undefined) {
|
|
@@ -27547,8 +27563,10 @@ function getStandardJSON(json) {
|
|
|
27547
27563
|
json = version30Migration(version21Migration(json));
|
|
27548
27564
|
}
|
|
27549
27565
|
// 3.x 版本格式转换
|
|
27550
|
-
if (mainVersion < 4
|
|
27551
|
-
|
|
27566
|
+
if (mainVersion < 4) {
|
|
27567
|
+
if (mainVersion === 3 && minorVersion < 2) {
|
|
27568
|
+
json = version31Migration(json);
|
|
27569
|
+
}
|
|
27552
27570
|
}
|
|
27553
27571
|
return json;
|
|
27554
27572
|
}
|
|
@@ -28839,6 +28857,8 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
28839
28857
|
0,
|
|
28840
28858
|
0
|
|
28841
28859
|
] : _options_rotation;
|
|
28860
|
+
var euler = new Euler(rotation[0], rotation[1], rotation[2]);
|
|
28861
|
+
var quat = new Quaternion().setFromEuler(euler);
|
|
28842
28862
|
this.options = {
|
|
28843
28863
|
near: near,
|
|
28844
28864
|
far: far,
|
|
@@ -28847,7 +28867,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
28847
28867
|
clipMode: clipMode
|
|
28848
28868
|
};
|
|
28849
28869
|
this.transform.setPosition(position[0], position[1], position[2]);
|
|
28850
|
-
this.transform.
|
|
28870
|
+
this.transform.setQuaternion(quat.x, quat.y, quat.z, quat.w);
|
|
28851
28871
|
this.dirty = true;
|
|
28852
28872
|
this.updateMatrix();
|
|
28853
28873
|
}
|
|
@@ -32101,7 +32121,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
|
|
|
32101
32121
|
registerPlugin("particle", ParticleLoader, exports.VFXItem);
|
|
32102
32122
|
registerPlugin("cal", CalculateLoader, exports.VFXItem);
|
|
32103
32123
|
registerPlugin("interact", InteractLoader, exports.VFXItem);
|
|
32104
|
-
var version$1 = "2.3.
|
|
32124
|
+
var version$1 = "2.3.2";
|
|
32105
32125
|
logger.info("Core version: " + version$1 + ".");
|
|
32106
32126
|
|
|
32107
32127
|
var _obj;
|
|
@@ -33408,7 +33428,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
33408
33428
|
_this.assetService.prepareAssets(_$scene, assetManager.getAssets());
|
|
33409
33429
|
_this.assetService.updateTextVariables(_$scene, assetManager.options.variables);
|
|
33410
33430
|
_this.assetService.initializeTexture(_$scene);
|
|
33411
|
-
_$scene.pluginSystem.precompile(_$scene.jsonScene.compositions, _this.renderer
|
|
33431
|
+
_$scene.pluginSystem.precompile(_$scene.jsonScene.compositions, _this.renderer);
|
|
33412
33432
|
composition = _this.createComposition(_$scene, opts);
|
|
33413
33433
|
_this.baseCompositionIndex += 1;
|
|
33414
33434
|
composition.setIndex(baseOrder + index);
|
|
@@ -33701,7 +33721,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
33701
33721
|
*/ Mesh.create = function(engine, props) {
|
|
33702
33722
|
return new ThreeMesh(engine, props);
|
|
33703
33723
|
};
|
|
33704
|
-
var version = "2.3.
|
|
33724
|
+
var version = "2.3.2";
|
|
33705
33725
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
33706
33726
|
|
|
33707
33727
|
exports.AbstractPlugin = AbstractPlugin;
|