@galacean/effects-threejs 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/index.js +62 -82
- 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 +62 -82
- 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.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.33
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -16005,6 +16005,17 @@ var Link = /*#__PURE__*/ function() {
|
|
|
16005
16005
|
}while (node = node.pre);
|
|
16006
16006
|
}
|
|
16007
16007
|
};
|
|
16008
|
+
_proto.getNodeByIndex = function getNodeByIndex(index) {
|
|
16009
|
+
var i = 0, res = this.first;
|
|
16010
|
+
if (!res || index >= this.length || index < 0) {
|
|
16011
|
+
return null;
|
|
16012
|
+
}
|
|
16013
|
+
while(i < index){
|
|
16014
|
+
res = res.next;
|
|
16015
|
+
i++;
|
|
16016
|
+
}
|
|
16017
|
+
return res;
|
|
16018
|
+
};
|
|
16008
16019
|
return Link;
|
|
16009
16020
|
}();
|
|
16010
16021
|
|
|
@@ -16841,10 +16852,8 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16841
16852
|
content[3].delay -= duration;
|
|
16842
16853
|
});
|
|
16843
16854
|
this.renderer.minusTimeForLoop(duration);
|
|
16844
|
-
this.onIterate(this);
|
|
16845
16855
|
} else {
|
|
16846
16856
|
this.ended = true;
|
|
16847
|
-
this.onEnd(this);
|
|
16848
16857
|
var endBehavior = this.item.endBehavior;
|
|
16849
16858
|
if (endBehavior === EndBehavior.freeze) {
|
|
16850
16859
|
this.frozen = true;
|
|
@@ -16992,7 +17001,21 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16992
17001
|
time: startTime
|
|
16993
17002
|
});
|
|
16994
17003
|
};
|
|
16995
|
-
|
|
17004
|
+
/**
|
|
17005
|
+
* 通过索引获取指定index粒子当前时刻的位置
|
|
17006
|
+
* @params index - 粒子索引
|
|
17007
|
+
*/ _proto.getPointPositionByIndex = function getPointPositionByIndex(index) {
|
|
17008
|
+
var point = this.particleLink.getNodeByIndex(index);
|
|
17009
|
+
if (!point) {
|
|
17010
|
+
console.error("Get point error.");
|
|
17011
|
+
return null;
|
|
17012
|
+
} else {
|
|
17013
|
+
return this.getPointPosition(point.content[3]);
|
|
17014
|
+
}
|
|
17015
|
+
};
|
|
17016
|
+
/**
|
|
17017
|
+
* 通过粒子参数获取当前时刻粒子的位置
|
|
17018
|
+
*/ _proto.getPointPosition = function getPointPosition(point) {
|
|
16996
17019
|
var transform = point.transform, vel = point.vel, lifetime = point.lifetime, delay = point.delay, _point_gravity = point.gravity, gravity = _point_gravity === void 0 ? [] : _point_gravity;
|
|
16997
17020
|
var forceTarget = this.options.forceTarget;
|
|
16998
17021
|
var time = this.lastUpdate - delay;
|
|
@@ -17014,8 +17037,6 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
17014
17037
|
}
|
|
17015
17038
|
return ret;
|
|
17016
17039
|
};
|
|
17017
|
-
_proto.onEnd = function onEnd(particle) {};
|
|
17018
|
-
_proto.onIterate = function onIterate(particle) {};
|
|
17019
17040
|
_proto.initPoint = function initPoint(data) {
|
|
17020
17041
|
var options = this.options;
|
|
17021
17042
|
var lifetime = this.lifetime;
|
|
@@ -17974,31 +17995,6 @@ var ParticleMesh = /*#__PURE__*/ function() {
|
|
|
17974
17995
|
data[i + 3]
|
|
17975
17996
|
];
|
|
17976
17997
|
};
|
|
17977
|
-
/**
|
|
17978
|
-
* 待废弃
|
|
17979
|
-
* @deprecated - 使用 `particle-system.getPointPosition` 替代
|
|
17980
|
-
*/ _proto.getPointPosition = function getPointPosition(index) {
|
|
17981
|
-
var geo = this.geometry;
|
|
17982
|
-
var posIndex = index * 48;
|
|
17983
|
-
var posData = geo.getAttributeData("aPos");
|
|
17984
|
-
var offsetData = geo.getAttributeData("aOffset");
|
|
17985
|
-
var time = this.time - offsetData[index * 16 + 2];
|
|
17986
|
-
var pointDur = offsetData[index * 16 + 3];
|
|
17987
|
-
var mtl = this.mesh.material;
|
|
17988
|
-
var acc = mtl.getVector4("uAcceleration").toVector3();
|
|
17989
|
-
var pos = Vector3.fromArray(posData, posIndex);
|
|
17990
|
-
var vel = Vector3.fromArray(posData, posIndex + 3);
|
|
17991
|
-
var ret = calculateTranslation(new Vector3(), this, acc, time, pointDur, pos, vel);
|
|
17992
|
-
if (this.forceTarget) {
|
|
17993
|
-
var target = mtl.getVector3("uFinalTarget");
|
|
17994
|
-
var life = this.forceTarget.curve.getValue(time / pointDur);
|
|
17995
|
-
var dl = 1 - life;
|
|
17996
|
-
ret.x = ret.x * dl + target.x * life;
|
|
17997
|
-
ret.y = ret.y * dl + target.y * life;
|
|
17998
|
-
ret.z = ret.z * dl + target.z * life;
|
|
17999
|
-
}
|
|
18000
|
-
return ret;
|
|
18001
|
-
};
|
|
18002
17998
|
_proto.clearPoints = function clearPoints() {
|
|
18003
17999
|
this.resetGeometryData(this.geometry);
|
|
18004
18000
|
this.particleCount = 0;
|
|
@@ -19353,9 +19349,6 @@ function compareTracks(a, b) {
|
|
|
19353
19349
|
_this.startTime = 0;
|
|
19354
19350
|
_this.items = [] // 场景的所有元素
|
|
19355
19351
|
;
|
|
19356
|
-
/**
|
|
19357
|
-
* 合成是否冻结标志位
|
|
19358
|
-
*/ _this.fezzed = false;
|
|
19359
19352
|
_this.reusable = false;
|
|
19360
19353
|
_this.sceneBindings = [];
|
|
19361
19354
|
_this.graph = new PlayableGraph();
|
|
@@ -25023,28 +25016,6 @@ var listOrder = 0;
|
|
|
25023
25016
|
}
|
|
25024
25017
|
};
|
|
25025
25018
|
/**
|
|
25026
|
-
* 是否合成需要重新播放
|
|
25027
|
-
* @returns 重新播放合成标志位
|
|
25028
|
-
*/ _proto.shouldRestart = function shouldRestart() {
|
|
25029
|
-
var _this_rootItem = this.rootItem, duration = _this_rootItem.duration, endBehavior = _this_rootItem.endBehavior;
|
|
25030
|
-
var time = this.rootComposition.time;
|
|
25031
|
-
return endBehavior === EndBehavior.restart && duration - time < 0.02;
|
|
25032
|
-
};
|
|
25033
|
-
/**
|
|
25034
|
-
* 是否合成需要销毁
|
|
25035
|
-
* @returns 销毁合成标志位
|
|
25036
|
-
*/ _proto.shouldDispose = function shouldDispose() {
|
|
25037
|
-
if (this.reusable) {
|
|
25038
|
-
return false;
|
|
25039
|
-
}
|
|
25040
|
-
var endBehavior = this.rootItem.endBehavior;
|
|
25041
|
-
if (this.rootItem.isEnded(this.time)) {
|
|
25042
|
-
this.rootItem.ended = true;
|
|
25043
|
-
}
|
|
25044
|
-
// TODO: 合成结束行为
|
|
25045
|
-
return this.rootItem.ended && endBehavior === EndBehavior.destroy;
|
|
25046
|
-
};
|
|
25047
|
-
/**
|
|
25048
25019
|
* 合成更新,针对所有 item 的更新
|
|
25049
25020
|
* @param deltaTime - 更新的时间步长
|
|
25050
25021
|
* @param skipRender - 是否需要渲染
|
|
@@ -25055,49 +25026,56 @@ var listOrder = 0;
|
|
|
25055
25026
|
var time = this.getUpdateTime(deltaTime * this.speed);
|
|
25056
25027
|
this.globalTime += time;
|
|
25057
25028
|
this.updateRootComposition();
|
|
25058
|
-
if (this.shouldRestart()) {
|
|
25059
|
-
this.emit("end", {
|
|
25060
|
-
composition: this
|
|
25061
|
-
});
|
|
25062
|
-
this.restart();
|
|
25063
|
-
// restart then tick to avoid flicker
|
|
25064
|
-
}
|
|
25065
25029
|
this.updateVideo();
|
|
25066
25030
|
// 更新 model-tree-plugin
|
|
25067
25031
|
this.updatePluginLoaders(deltaTime);
|
|
25032
|
+
// scene VFXItem components lifetime function.
|
|
25068
25033
|
this.callStart(this.rootItem);
|
|
25069
25034
|
this.callUpdate(this.rootItem, time);
|
|
25070
25035
|
this.callLateUpdate(this.rootItem, time);
|
|
25071
25036
|
this.updateCamera();
|
|
25037
|
+
this.prepareRender();
|
|
25072
25038
|
if (this.shouldDispose()) {
|
|
25073
|
-
this.emit("end", {
|
|
25074
|
-
composition: this
|
|
25075
|
-
});
|
|
25076
25039
|
this.dispose();
|
|
25077
|
-
} else {
|
|
25078
|
-
this.prepareRender();
|
|
25079
25040
|
}
|
|
25080
25041
|
};
|
|
25081
25042
|
_proto.toLocalTime = function toLocalTime(time) {
|
|
25082
25043
|
var localTime = time - this.rootItem.start;
|
|
25083
25044
|
var duration = this.rootItem.duration;
|
|
25084
25045
|
if (localTime - duration > 0.001) {
|
|
25085
|
-
if (this.rootItem.
|
|
25086
|
-
|
|
25087
|
-
|
|
25088
|
-
|
|
25089
|
-
|
|
25090
|
-
|
|
25091
|
-
|
|
25092
|
-
|
|
25093
|
-
|
|
25094
|
-
|
|
25046
|
+
if (!this.rootItem.ended) {
|
|
25047
|
+
this.rootItem.ended = true;
|
|
25048
|
+
this.emit("end", {
|
|
25049
|
+
composition: this
|
|
25050
|
+
});
|
|
25051
|
+
}
|
|
25052
|
+
switch(this.rootItem.endBehavior){
|
|
25053
|
+
case EndBehavior.restart:
|
|
25054
|
+
{
|
|
25055
|
+
localTime = localTime % duration;
|
|
25056
|
+
this.restart();
|
|
25057
|
+
break;
|
|
25058
|
+
}
|
|
25059
|
+
case EndBehavior.freeze:
|
|
25060
|
+
{
|
|
25061
|
+
localTime = Math.min(duration, localTime);
|
|
25062
|
+
break;
|
|
25063
|
+
}
|
|
25064
|
+
case EndBehavior.forward:
|
|
25065
|
+
{
|
|
25066
|
+
break;
|
|
25067
|
+
}
|
|
25068
|
+
case EndBehavior.destroy:
|
|
25069
|
+
{
|
|
25070
|
+
break;
|
|
25095
25071
|
}
|
|
25096
|
-
}
|
|
25097
25072
|
}
|
|
25098
25073
|
}
|
|
25099
25074
|
return localTime;
|
|
25100
25075
|
};
|
|
25076
|
+
_proto.shouldDispose = function shouldDispose() {
|
|
25077
|
+
return this.rootItem.ended && this.rootItem.endBehavior === EndBehavior.destroy && !this.reusable;
|
|
25078
|
+
};
|
|
25101
25079
|
_proto.getUpdateTime = function getUpdateTime(t) {
|
|
25102
25080
|
var startTimeInMs = this.startTime * 1000;
|
|
25103
25081
|
var now = this.rootComposition.time * 1000;
|
|
@@ -25428,7 +25406,9 @@ var listOrder = 0;
|
|
|
25428
25406
|
(_this_rendererOptions = this.rendererOptions) == null ? void 0 : _this_rendererOptions.emptyTexture.dispose();
|
|
25429
25407
|
(_this_pluginSystem = this.pluginSystem) == null ? void 0 : _this_pluginSystem.destroyComposition(this);
|
|
25430
25408
|
this.update = function() {
|
|
25431
|
-
|
|
25409
|
+
{
|
|
25410
|
+
logger.error("Update disposed composition: " + _this.name + ".");
|
|
25411
|
+
}
|
|
25432
25412
|
};
|
|
25433
25413
|
this.dispose = noop;
|
|
25434
25414
|
if (textures && this.keepResource) {
|
|
@@ -27591,7 +27571,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
27591
27571
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
27592
27572
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
27593
27573
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
27594
|
-
var version$1 = "2.0.0-alpha.
|
|
27574
|
+
var version$1 = "2.0.0-alpha.33";
|
|
27595
27575
|
logger.info("Core version: " + version$1 + ".");
|
|
27596
27576
|
|
|
27597
27577
|
var _obj;
|
|
@@ -29258,7 +29238,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
29258
29238
|
*/ Mesh.create = function(engine, props) {
|
|
29259
29239
|
return new ThreeMesh(engine, props);
|
|
29260
29240
|
};
|
|
29261
|
-
var version = "2.0.0-alpha.
|
|
29241
|
+
var version = "2.0.0-alpha.33";
|
|
29262
29242
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
29263
29243
|
|
|
29264
29244
|
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, 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, 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, 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, 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, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
|