@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.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.1
|
|
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
|
}
|
|
@@ -26652,14 +26645,36 @@ function getStandardInteractContent(ui) {
|
|
|
26652
26645
|
// @ts-expect-error
|
|
26653
26646
|
customShapeComponent.fill = customShapeComponent.shapes[0].fill;
|
|
26654
26647
|
}
|
|
26648
|
+
// easingIn 和 easingOut 绝对坐标转相对坐标
|
|
26649
|
+
var easingInFlag = new Array(customShapeComponent.easingIns.length);
|
|
26650
|
+
var easingOutFlag = new Array(customShapeComponent.easingOuts.length).fill(false);
|
|
26651
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(customShapeComponent.shapes), _step1; !(_step1 = _iterator1()).done;){
|
|
26652
|
+
var shape = _step1.value;
|
|
26653
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(shape.indexes), _step2; !(_step2 = _iterator2()).done;){
|
|
26654
|
+
var index = _step2.value;
|
|
26655
|
+
var point = customShapeComponent.points[index.point];
|
|
26656
|
+
var easingIn = customShapeComponent.easingIns[index.easingIn];
|
|
26657
|
+
var easingOut = customShapeComponent.easingOuts[index.easingOut];
|
|
26658
|
+
if (!easingInFlag[index.easingIn]) {
|
|
26659
|
+
easingIn.x -= point.x;
|
|
26660
|
+
easingIn.y -= point.y;
|
|
26661
|
+
easingInFlag[index.easingIn] = true;
|
|
26662
|
+
}
|
|
26663
|
+
if (!easingOutFlag[index.easingOut]) {
|
|
26664
|
+
easingOut.x -= point.x;
|
|
26665
|
+
easingOut.y -= point.y;
|
|
26666
|
+
easingOutFlag[index.easingOut] = true;
|
|
26667
|
+
}
|
|
26668
|
+
}
|
|
26669
|
+
}
|
|
26655
26670
|
}
|
|
26656
26671
|
}
|
|
26657
26672
|
}
|
|
26658
26673
|
// Composition id 转 guid
|
|
26659
26674
|
var compositionId = json.compositionId;
|
|
26660
26675
|
var compositionIdToGUIDMap = {};
|
|
26661
|
-
for(var
|
|
26662
|
-
var composition =
|
|
26676
|
+
for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
|
|
26677
|
+
var composition = _step3.value;
|
|
26663
26678
|
var guid = generateGUID();
|
|
26664
26679
|
compositionIdToGUIDMap[composition.id] = guid;
|
|
26665
26680
|
if (composition.id === compositionId) {
|
|
@@ -26668,8 +26683,8 @@ function getStandardInteractContent(ui) {
|
|
|
26668
26683
|
composition.id = guid;
|
|
26669
26684
|
}
|
|
26670
26685
|
// 预合成元素 refId 同步改为生成的合成 guid
|
|
26671
|
-
for(var
|
|
26672
|
-
var item =
|
|
26686
|
+
for(var _iterator4 = _create_for_of_iterator_helper_loose(json.items), _step4; !(_step4 = _iterator4()).done;){
|
|
26687
|
+
var item = _step4.value;
|
|
26673
26688
|
if (item.content) {
|
|
26674
26689
|
var compositionOptions = item.content.options;
|
|
26675
26690
|
if (compositionOptions && compositionOptions.refId !== undefined) {
|
|
@@ -27523,8 +27538,10 @@ function getStandardJSON(json) {
|
|
|
27523
27538
|
json = version30Migration(version21Migration(json));
|
|
27524
27539
|
}
|
|
27525
27540
|
// 3.x 版本格式转换
|
|
27526
|
-
if (mainVersion < 4
|
|
27527
|
-
|
|
27541
|
+
if (mainVersion < 4) {
|
|
27542
|
+
if (mainVersion === 3 && minorVersion < 2) {
|
|
27543
|
+
json = version31Migration(json);
|
|
27544
|
+
}
|
|
27528
27545
|
}
|
|
27529
27546
|
return json;
|
|
27530
27547
|
}
|
|
@@ -32077,7 +32094,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
|
|
|
32077
32094
|
registerPlugin("particle", ParticleLoader, VFXItem);
|
|
32078
32095
|
registerPlugin("cal", CalculateLoader, VFXItem);
|
|
32079
32096
|
registerPlugin("interact", InteractLoader, VFXItem);
|
|
32080
|
-
var version$1 = "2.3.
|
|
32097
|
+
var version$1 = "2.3.1";
|
|
32081
32098
|
logger.info("Core version: " + version$1 + ".");
|
|
32082
32099
|
|
|
32083
32100
|
var _obj;
|
|
@@ -33384,7 +33401,7 @@ var ThreeRenderer = /*#__PURE__*/ function(Renderer) {
|
|
|
33384
33401
|
_this.assetService.prepareAssets(_$scene, assetManager.getAssets());
|
|
33385
33402
|
_this.assetService.updateTextVariables(_$scene, assetManager.options.variables);
|
|
33386
33403
|
_this.assetService.initializeTexture(_$scene);
|
|
33387
|
-
_$scene.pluginSystem.precompile(_$scene.jsonScene.compositions, _this.renderer
|
|
33404
|
+
_$scene.pluginSystem.precompile(_$scene.jsonScene.compositions, _this.renderer);
|
|
33388
33405
|
composition = _this.createComposition(_$scene, opts);
|
|
33389
33406
|
_this.baseCompositionIndex += 1;
|
|
33390
33407
|
composition.setIndex(baseOrder + index);
|
|
@@ -33677,7 +33694,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
33677
33694
|
*/ Mesh.create = function(engine, props) {
|
|
33678
33695
|
return new ThreeMesh(engine, props);
|
|
33679
33696
|
};
|
|
33680
|
-
var version = "2.3.
|
|
33697
|
+
var version = "2.3.1";
|
|
33681
33698
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
33682
33699
|
|
|
33683
33700
|
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 };
|