@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.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: v2.3.
|
|
6
|
+
* Version: v2.3.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -928,10 +928,10 @@ var PluginSystem = /*#__PURE__*/ function() {
|
|
|
928
928
|
});
|
|
929
929
|
})();
|
|
930
930
|
};
|
|
931
|
-
_proto.precompile = function precompile(compositions, renderer
|
|
931
|
+
_proto.precompile = function precompile(compositions, renderer) {
|
|
932
932
|
for(var _iterator = _create_for_of_iterator_helper_loose(this.plugins), _step; !(_step = _iterator()).done;){
|
|
933
933
|
var plugin = _step.value;
|
|
934
|
-
plugin.precompile(compositions, renderer
|
|
934
|
+
plugin.precompile(compositions, renderer);
|
|
935
935
|
}
|
|
936
936
|
};
|
|
937
937
|
_proto.loadResources = function loadResources(scene, options) {
|
|
@@ -1006,7 +1006,7 @@ function getPluginUsageInfo(name) {
|
|
|
1006
1006
|
* 在加载到 JSON 后,就可以进行提前编译
|
|
1007
1007
|
* @param json
|
|
1008
1008
|
* @param player
|
|
1009
|
-
*/ _proto.precompile = function precompile(compositions, renderer
|
|
1009
|
+
*/ _proto.precompile = function precompile(compositions, renderer) {};
|
|
1010
1010
|
_proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {};
|
|
1011
1011
|
_proto.onCompositionItemLifeBegin = function onCompositionItemLifeBegin(composition, item) {};
|
|
1012
1012
|
_proto.onCompositionItemLifeEnd = function onCompositionItemLifeEnd(composition, item) {};
|
|
@@ -16325,7 +16325,6 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16325
16325
|
_this.hasFill = false;
|
|
16326
16326
|
_this.shapeDirty = true;
|
|
16327
16327
|
_this.graphicsPath = new GraphicsPath();
|
|
16328
|
-
_this.curveValues = [];
|
|
16329
16328
|
_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";
|
|
16330
16329
|
_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";
|
|
16331
16330
|
if (!_this.geometry) {
|
|
@@ -16507,31 +16506,25 @@ var ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
|
|
|
16507
16506
|
var easingOuts = customShapeAtribute.easingOuts;
|
|
16508
16507
|
for(var _iterator = _create_for_of_iterator_helper_loose(customShapeAtribute.shapes), _step; !(_step = _iterator()).done;){
|
|
16509
16508
|
var shape = _step.value;
|
|
16510
|
-
this.curveValues = [];
|
|
16511
16509
|
var indices = shape.indexes;
|
|
16510
|
+
var startPoint = points[indices[0].point];
|
|
16511
|
+
this.graphicsPath.moveTo(startPoint.x, startPoint.y);
|
|
16512
16512
|
for(var i = 1; i < indices.length; i++){
|
|
16513
16513
|
var pointIndex = indices[i];
|
|
16514
16514
|
var lastPointIndex = indices[i - 1];
|
|
16515
|
-
|
|
16516
|
-
|
|
16517
|
-
|
|
16518
|
-
|
|
16519
|
-
|
|
16520
|
-
}
|
|
16521
|
-
// Push the last curve
|
|
16522
|
-
this.curveValues.push({
|
|
16523
|
-
point: points[indices[0].point],
|
|
16524
|
-
controlPoint1: easingOuts[indices[indices.length - 1].easingOut],
|
|
16525
|
-
controlPoint2: easingIns[indices[0].easingIn]
|
|
16526
|
-
});
|
|
16527
|
-
this.graphicsPath.moveTo(this.curveValues[this.curveValues.length - 1].point.x, this.curveValues[this.curveValues.length - 1].point.y);
|
|
16528
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(this.curveValues), _step1; !(_step1 = _iterator1()).done;){
|
|
16529
|
-
var curveValue = _step1.value;
|
|
16530
|
-
var point = curveValue.point;
|
|
16531
|
-
var control1 = curveValue.controlPoint1;
|
|
16532
|
-
var control2 = curveValue.controlPoint2;
|
|
16533
|
-
this.graphicsPath.bezierCurveTo(control1.x, control1.y, control2.x, control2.y, point.x, point.y, 1);
|
|
16515
|
+
var point = points[pointIndex.point];
|
|
16516
|
+
var lastPoint = points[lastPointIndex.point];
|
|
16517
|
+
var control1 = easingOuts[lastPointIndex.easingOut];
|
|
16518
|
+
var control2 = easingIns[pointIndex.easingIn];
|
|
16519
|
+
this.graphicsPath.bezierCurveTo(control1.x + lastPoint.x, control1.y + lastPoint.y, control2.x + point.x, control2.y + point.y, point.x, point.y, 1);
|
|
16534
16520
|
}
|
|
16521
|
+
var pointIndex1 = indices[0];
|
|
16522
|
+
var lastPointIndex1 = indices[indices.length - 1];
|
|
16523
|
+
var point1 = points[pointIndex1.point];
|
|
16524
|
+
var lastPoint1 = points[lastPointIndex1.point];
|
|
16525
|
+
var control11 = easingOuts[lastPointIndex1.easingOut];
|
|
16526
|
+
var control21 = easingIns[pointIndex1.easingIn];
|
|
16527
|
+
this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, 1);
|
|
16535
16528
|
if (shape.close) {
|
|
16536
16529
|
this.graphicsPath.closePath();
|
|
16537
16530
|
}
|
|
@@ -17938,6 +17931,7 @@ var seed$4 = 1;
|
|
|
17938
17931
|
this.rotation.y = y;
|
|
17939
17932
|
this.rotation.z = z;
|
|
17940
17933
|
this.quat.setFromEuler(this.rotation);
|
|
17934
|
+
// TODO 修正 GE 四元数旋转共轭问题
|
|
17941
17935
|
this.quat.conjugate();
|
|
17942
17936
|
this.dirtyFlags.localData = true;
|
|
17943
17937
|
this.dispatchValueChange();
|
|
@@ -26652,14 +26646,36 @@ function getStandardInteractContent(ui) {
|
|
|
26652
26646
|
// @ts-expect-error
|
|
26653
26647
|
customShapeComponent.fill = customShapeComponent.shapes[0].fill;
|
|
26654
26648
|
}
|
|
26649
|
+
// easingIn 和 easingOut 绝对坐标转相对坐标
|
|
26650
|
+
var easingInFlag = new Array(customShapeComponent.easingIns.length);
|
|
26651
|
+
var easingOutFlag = new Array(customShapeComponent.easingOuts.length).fill(false);
|
|
26652
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(customShapeComponent.shapes), _step1; !(_step1 = _iterator1()).done;){
|
|
26653
|
+
var shape = _step1.value;
|
|
26654
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(shape.indexes), _step2; !(_step2 = _iterator2()).done;){
|
|
26655
|
+
var index = _step2.value;
|
|
26656
|
+
var point = customShapeComponent.points[index.point];
|
|
26657
|
+
var easingIn = customShapeComponent.easingIns[index.easingIn];
|
|
26658
|
+
var easingOut = customShapeComponent.easingOuts[index.easingOut];
|
|
26659
|
+
if (!easingInFlag[index.easingIn]) {
|
|
26660
|
+
easingIn.x -= point.x;
|
|
26661
|
+
easingIn.y -= point.y;
|
|
26662
|
+
easingInFlag[index.easingIn] = true;
|
|
26663
|
+
}
|
|
26664
|
+
if (!easingOutFlag[index.easingOut]) {
|
|
26665
|
+
easingOut.x -= point.x;
|
|
26666
|
+
easingOut.y -= point.y;
|
|
26667
|
+
easingOutFlag[index.easingOut] = true;
|
|
26668
|
+
}
|
|
26669
|
+
}
|
|
26670
|
+
}
|
|
26655
26671
|
}
|
|
26656
26672
|
}
|
|
26657
26673
|
}
|
|
26658
26674
|
// Composition id 转 guid
|
|
26659
26675
|
var compositionId = json.compositionId;
|
|
26660
26676
|
var compositionIdToGUIDMap = {};
|
|
26661
|
-
for(var
|
|
26662
|
-
var composition =
|
|
26677
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
|
|
26678
|
+
var composition = _step3.value;
|
|
26663
26679
|
var guid = generateGUID();
|
|
26664
26680
|
compositionIdToGUIDMap[composition.id] = guid;
|
|
26665
26681
|
if (composition.id === compositionId) {
|
|
@@ -26668,8 +26684,8 @@ function getStandardInteractContent(ui) {
|
|
|
26668
26684
|
composition.id = guid;
|
|
26669
26685
|
}
|
|
26670
26686
|
// 预合成元素 refId 同步改为生成的合成 guid
|
|
26671
|
-
for(var
|
|
26672
|
-
var item =
|
|
26687
|
+
for(var _iterator4 = _create_for_of_iterator_helper_loose(json.items), _step4; !(_step4 = _iterator4()).done;){
|
|
26688
|
+
var item = _step4.value;
|
|
26673
26689
|
if (item.content) {
|
|
26674
26690
|
var compositionOptions = item.content.options;
|
|
26675
26691
|
if (compositionOptions && compositionOptions.refId !== undefined) {
|
|
@@ -27523,8 +27539,10 @@ function getStandardJSON(json) {
|
|
|
27523
27539
|
json = version30Migration(version21Migration(json));
|
|
27524
27540
|
}
|
|
27525
27541
|
// 3.x 版本格式转换
|
|
27526
|
-
if (mainVersion < 4
|
|
27527
|
-
|
|
27542
|
+
if (mainVersion < 4) {
|
|
27543
|
+
if (mainVersion === 3 && minorVersion < 2) {
|
|
27544
|
+
json = version31Migration(json);
|
|
27545
|
+
}
|
|
27528
27546
|
}
|
|
27529
27547
|
return json;
|
|
27530
27548
|
}
|
|
@@ -28815,6 +28833,8 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
28815
28833
|
0,
|
|
28816
28834
|
0
|
|
28817
28835
|
] : _options_rotation;
|
|
28836
|
+
var euler = new Euler(rotation[0], rotation[1], rotation[2]);
|
|
28837
|
+
var quat = new Quaternion().setFromEuler(euler);
|
|
28818
28838
|
this.options = {
|
|
28819
28839
|
near: near,
|
|
28820
28840
|
far: far,
|
|
@@ -28823,7 +28843,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
28823
28843
|
clipMode: clipMode
|
|
28824
28844
|
};
|
|
28825
28845
|
this.transform.setPosition(position[0], position[1], position[2]);
|
|
28826
|
-
this.transform.
|
|
28846
|
+
this.transform.setQuaternion(quat.x, quat.y, quat.z, quat.w);
|
|
28827
28847
|
this.dirty = true;
|
|
28828
28848
|
this.updateMatrix();
|
|
28829
28849
|
}
|
|
@@ -32077,7 +32097,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
|
|
|
32077
32097
|
registerPlugin("particle", ParticleLoader, VFXItem);
|
|
32078
32098
|
registerPlugin("cal", CalculateLoader, VFXItem);
|
|
32079
32099
|
registerPlugin("interact", InteractLoader, VFXItem);
|
|
32080
|
-
var version$1 = "2.3.
|
|
32100
|
+
var version$1 = "2.3.2";
|
|
32081
32101
|
logger.info("Core version: " + version$1 + ".");
|
|
32082
32102
|
|
|
32083
32103
|
var _obj;
|
|
@@ -33384,7 +33404,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
33384
33404
|
_this.assetService.prepareAssets(_$scene, assetManager.getAssets());
|
|
33385
33405
|
_this.assetService.updateTextVariables(_$scene, assetManager.options.variables);
|
|
33386
33406
|
_this.assetService.initializeTexture(_$scene);
|
|
33387
|
-
_$scene.pluginSystem.precompile(_$scene.jsonScene.compositions, _this.renderer
|
|
33407
|
+
_$scene.pluginSystem.precompile(_$scene.jsonScene.compositions, _this.renderer);
|
|
33388
33408
|
composition = _this.createComposition(_$scene, opts);
|
|
33389
33409
|
_this.baseCompositionIndex += 1;
|
|
33390
33410
|
composition.setIndex(baseOrder + index);
|
|
@@ -33677,7 +33697,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
33677
33697
|
*/ Mesh.create = function(engine, props) {
|
|
33678
33698
|
return new ThreeMesh(engine, props);
|
|
33679
33699
|
};
|
|
33680
|
-
var version = "2.3.
|
|
33700
|
+
var version = "2.3.2";
|
|
33681
33701
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
33682
33702
|
|
|
33683
33703
|
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector2Curve, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|