@galacean/effects-core 2.0.0-alpha.32 → 2.0.0-alpha.33
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/comp-vfx-item.d.ts +0 -4
- package/dist/composition.d.ts +1 -10
- package/dist/index.js +61 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -81
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/particle/link.d.ts +1 -0
- package/dist/plugins/particle/particle-mesh.d.ts +0 -5
- package/dist/plugins/particle/particle-system.d.ts +8 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime core for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.33
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -16003,6 +16003,17 @@ var Link = /*#__PURE__*/ function() {
|
|
|
16003
16003
|
}while (node = node.pre);
|
|
16004
16004
|
}
|
|
16005
16005
|
};
|
|
16006
|
+
_proto.getNodeByIndex = function getNodeByIndex(index) {
|
|
16007
|
+
var i = 0, res = this.first;
|
|
16008
|
+
if (!res || index >= this.length || index < 0) {
|
|
16009
|
+
return null;
|
|
16010
|
+
}
|
|
16011
|
+
while(i < index){
|
|
16012
|
+
res = res.next;
|
|
16013
|
+
i++;
|
|
16014
|
+
}
|
|
16015
|
+
return res;
|
|
16016
|
+
};
|
|
16006
16017
|
return Link;
|
|
16007
16018
|
}();
|
|
16008
16019
|
|
|
@@ -16839,10 +16850,8 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16839
16850
|
content[3].delay -= duration;
|
|
16840
16851
|
});
|
|
16841
16852
|
this.renderer.minusTimeForLoop(duration);
|
|
16842
|
-
this.onIterate(this);
|
|
16843
16853
|
} else {
|
|
16844
16854
|
this.ended = true;
|
|
16845
|
-
this.onEnd(this);
|
|
16846
16855
|
var endBehavior = this.item.endBehavior;
|
|
16847
16856
|
if (endBehavior === EndBehavior.freeze) {
|
|
16848
16857
|
this.frozen = true;
|
|
@@ -16990,7 +16999,21 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16990
16999
|
time: startTime
|
|
16991
17000
|
});
|
|
16992
17001
|
};
|
|
16993
|
-
|
|
17002
|
+
/**
|
|
17003
|
+
* 通过索引获取指定index粒子当前时刻的位置
|
|
17004
|
+
* @params index - 粒子索引
|
|
17005
|
+
*/ _proto.getPointPositionByIndex = function getPointPositionByIndex(index) {
|
|
17006
|
+
var point = this.particleLink.getNodeByIndex(index);
|
|
17007
|
+
if (!point) {
|
|
17008
|
+
console.error("Get point error.");
|
|
17009
|
+
return null;
|
|
17010
|
+
} else {
|
|
17011
|
+
return this.getPointPosition(point.content[3]);
|
|
17012
|
+
}
|
|
17013
|
+
};
|
|
17014
|
+
/**
|
|
17015
|
+
* 通过粒子参数获取当前时刻粒子的位置
|
|
17016
|
+
*/ _proto.getPointPosition = function getPointPosition(point) {
|
|
16994
17017
|
var transform = point.transform, vel = point.vel, lifetime = point.lifetime, delay = point.delay, _point_gravity = point.gravity, gravity = _point_gravity === void 0 ? [] : _point_gravity;
|
|
16995
17018
|
var forceTarget = this.options.forceTarget;
|
|
16996
17019
|
var time = this.lastUpdate - delay;
|
|
@@ -17012,8 +17035,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
17012
17035
|
}
|
|
17013
17036
|
return ret;
|
|
17014
17037
|
};
|
|
17015
|
-
_proto.onEnd = function onEnd(particle) {};
|
|
17016
|
-
_proto.onIterate = function onIterate(particle) {};
|
|
17017
17038
|
_proto.initPoint = function initPoint(data) {
|
|
17018
17039
|
var options = this.options;
|
|
17019
17040
|
var lifetime = this.lifetime;
|
|
@@ -17972,31 +17993,6 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
17972
17993
|
data[i + 3]
|
|
17973
17994
|
];
|
|
17974
17995
|
};
|
|
17975
|
-
/**
|
|
17976
|
-
* 待废弃
|
|
17977
|
-
* @deprecated - 使用 `particle-system.getPointPosition` 替代
|
|
17978
|
-
*/ _proto.getPointPosition = function getPointPosition(index) {
|
|
17979
|
-
var geo = this.geometry;
|
|
17980
|
-
var posIndex = index * 48;
|
|
17981
|
-
var posData = geo.getAttributeData("aPos");
|
|
17982
|
-
var offsetData = geo.getAttributeData("aOffset");
|
|
17983
|
-
var time = this.time - offsetData[index * 16 + 2];
|
|
17984
|
-
var pointDur = offsetData[index * 16 + 3];
|
|
17985
|
-
var mtl = this.mesh.material;
|
|
17986
|
-
var acc = mtl.getVector4("uAcceleration").toVector3();
|
|
17987
|
-
var pos = Vector3.fromArray(posData, posIndex);
|
|
17988
|
-
var vel = Vector3.fromArray(posData, posIndex + 3);
|
|
17989
|
-
var ret = calculateTranslation(new Vector3(), this, acc, time, pointDur, pos, vel);
|
|
17990
|
-
if (this.forceTarget) {
|
|
17991
|
-
var target = mtl.getVector3("uFinalTarget");
|
|
17992
|
-
var life = this.forceTarget.curve.getValue(time / pointDur);
|
|
17993
|
-
var dl = 1 - life;
|
|
17994
|
-
ret.x = ret.x * dl + target.x * life;
|
|
17995
|
-
ret.y = ret.y * dl + target.y * life;
|
|
17996
|
-
ret.z = ret.z * dl + target.z * life;
|
|
17997
|
-
}
|
|
17998
|
-
return ret;
|
|
17999
|
-
};
|
|
18000
17996
|
_proto.clearPoints = function clearPoints() {
|
|
18001
17997
|
this.resetGeometryData(this.geometry);
|
|
18002
17998
|
this.particleCount = 0;
|
|
@@ -19351,9 +19347,6 @@ function compareTracks(a, b) {
|
|
|
19351
19347
|
_this.startTime = 0;
|
|
19352
19348
|
_this.items = [] // 场景的所有元素
|
|
19353
19349
|
;
|
|
19354
|
-
/**
|
|
19355
|
-
* 合成是否冻结标志位
|
|
19356
|
-
*/ _this.fezzed = false;
|
|
19357
19350
|
_this.reusable = false;
|
|
19358
19351
|
_this.sceneBindings = [];
|
|
19359
19352
|
_this.graph = new PlayableGraph();
|
|
@@ -25021,28 +25014,6 @@ var listOrder = 0;
|
|
|
25021
25014
|
}
|
|
25022
25015
|
};
|
|
25023
25016
|
/**
|
|
25024
|
-
* 是否合成需要重新播放
|
|
25025
|
-
* @returns 重新播放合成标志位
|
|
25026
|
-
*/ _proto.shouldRestart = function shouldRestart() {
|
|
25027
|
-
var _this_rootItem = this.rootItem, duration = _this_rootItem.duration, endBehavior = _this_rootItem.endBehavior;
|
|
25028
|
-
var time = this.rootComposition.time;
|
|
25029
|
-
return endBehavior === EndBehavior.restart && duration - time < 0.02;
|
|
25030
|
-
};
|
|
25031
|
-
/**
|
|
25032
|
-
* 是否合成需要销毁
|
|
25033
|
-
* @returns 销毁合成标志位
|
|
25034
|
-
*/ _proto.shouldDispose = function shouldDispose() {
|
|
25035
|
-
if (this.reusable) {
|
|
25036
|
-
return false;
|
|
25037
|
-
}
|
|
25038
|
-
var endBehavior = this.rootItem.endBehavior;
|
|
25039
|
-
if (this.rootItem.isEnded(this.time)) {
|
|
25040
|
-
this.rootItem.ended = true;
|
|
25041
|
-
}
|
|
25042
|
-
// TODO: 合成结束行为
|
|
25043
|
-
return this.rootItem.ended && endBehavior === EndBehavior.destroy;
|
|
25044
|
-
};
|
|
25045
|
-
/**
|
|
25046
25017
|
* 合成更新,针对所有 item 的更新
|
|
25047
25018
|
* @param deltaTime - 更新的时间步长
|
|
25048
25019
|
* @param skipRender - 是否需要渲染
|
|
@@ -25053,49 +25024,56 @@ var listOrder = 0;
|
|
|
25053
25024
|
var time = this.getUpdateTime(deltaTime * this.speed);
|
|
25054
25025
|
this.globalTime += time;
|
|
25055
25026
|
this.updateRootComposition();
|
|
25056
|
-
if (this.shouldRestart()) {
|
|
25057
|
-
this.emit("end", {
|
|
25058
|
-
composition: this
|
|
25059
|
-
});
|
|
25060
|
-
this.restart();
|
|
25061
|
-
// restart then tick to avoid flicker
|
|
25062
|
-
}
|
|
25063
25027
|
this.updateVideo();
|
|
25064
25028
|
// 更新 model-tree-plugin
|
|
25065
25029
|
this.updatePluginLoaders(deltaTime);
|
|
25030
|
+
// scene VFXItem components lifetime function.
|
|
25066
25031
|
this.callStart(this.rootItem);
|
|
25067
25032
|
this.callUpdate(this.rootItem, time);
|
|
25068
25033
|
this.callLateUpdate(this.rootItem, time);
|
|
25069
25034
|
this.updateCamera();
|
|
25035
|
+
this.prepareRender();
|
|
25070
25036
|
if (this.shouldDispose()) {
|
|
25071
|
-
this.emit("end", {
|
|
25072
|
-
composition: this
|
|
25073
|
-
});
|
|
25074
25037
|
this.dispose();
|
|
25075
|
-
} else {
|
|
25076
|
-
this.prepareRender();
|
|
25077
25038
|
}
|
|
25078
25039
|
};
|
|
25079
25040
|
_proto.toLocalTime = function toLocalTime(time) {
|
|
25080
25041
|
var localTime = time - this.rootItem.start;
|
|
25081
25042
|
var duration = this.rootItem.duration;
|
|
25082
25043
|
if (localTime - duration > 0.001) {
|
|
25083
|
-
if (this.rootItem.
|
|
25084
|
-
|
|
25085
|
-
|
|
25086
|
-
|
|
25087
|
-
|
|
25088
|
-
|
|
25089
|
-
|
|
25090
|
-
|
|
25091
|
-
|
|
25092
|
-
|
|
25044
|
+
if (!this.rootItem.ended) {
|
|
25045
|
+
this.rootItem.ended = true;
|
|
25046
|
+
this.emit("end", {
|
|
25047
|
+
composition: this
|
|
25048
|
+
});
|
|
25049
|
+
}
|
|
25050
|
+
switch(this.rootItem.endBehavior){
|
|
25051
|
+
case EndBehavior.restart:
|
|
25052
|
+
{
|
|
25053
|
+
localTime = localTime % duration;
|
|
25054
|
+
this.restart();
|
|
25055
|
+
break;
|
|
25056
|
+
}
|
|
25057
|
+
case EndBehavior.freeze:
|
|
25058
|
+
{
|
|
25059
|
+
localTime = Math.min(duration, localTime);
|
|
25060
|
+
break;
|
|
25061
|
+
}
|
|
25062
|
+
case EndBehavior.forward:
|
|
25063
|
+
{
|
|
25064
|
+
break;
|
|
25065
|
+
}
|
|
25066
|
+
case EndBehavior.destroy:
|
|
25067
|
+
{
|
|
25068
|
+
break;
|
|
25093
25069
|
}
|
|
25094
|
-
}
|
|
25095
25070
|
}
|
|
25096
25071
|
}
|
|
25097
25072
|
return localTime;
|
|
25098
25073
|
};
|
|
25074
|
+
_proto.shouldDispose = function shouldDispose() {
|
|
25075
|
+
return this.rootItem.ended && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
25076
|
+
};
|
|
25099
25077
|
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
25100
25078
|
var startTimeInMs = this.startTime * 1000;
|
|
25101
25079
|
var now = this.rootComposition.time * 1000;
|
|
@@ -25426,7 +25404,9 @@ var listOrder = 0;
|
|
|
25426
25404
|
(_this_rendererOptions = this.rendererOptions) == null ? void 0 : _this_rendererOptions.emptyTexture.dispose();
|
|
25427
25405
|
(_this_pluginSystem = this.pluginSystem) == null ? void 0 : _this_pluginSystem.destroyComposition(this);
|
|
25428
25406
|
this.update = function() {
|
|
25429
|
-
|
|
25407
|
+
{
|
|
25408
|
+
logger.error("Update disposed composition: " + _this.name + ".");
|
|
25409
|
+
}
|
|
25430
25410
|
};
|
|
25431
25411
|
this.dispose = noop;
|
|
25432
25412
|
if (textures && this.keepResource) {
|
|
@@ -27589,7 +27569,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
27589
27569
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
27590
27570
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
27591
27571
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
27592
|
-
var version = "2.0.0-alpha.
|
|
27572
|
+
var version = "2.0.0-alpha.33";
|
|
27593
27573
|
logger.info("Core version: " + version + ".");
|
|
27594
27574
|
|
|
27595
27575
|
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, 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, FilterMode, Float16ArrayWrapper, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, 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, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, ShaderVariant, SpriteColorPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMacros, createShape, createValueGetter, decimalEqual, defaultGlobalVolume, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, 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, isSceneJSON, isSceneURL, isSceneWithOptions, 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, pluginLoaderMap, pointOnLine, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
|