@galacean/effects-threejs 2.0.0-alpha.23 → 2.0.0-alpha.25
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 +46 -48
- 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 +46 -48
- 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.25
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -8873,6 +8873,7 @@ var MaterialRenderType;
|
|
|
8873
8873
|
var _this;
|
|
8874
8874
|
_this = EffectsObject.call(this, engine) || this;
|
|
8875
8875
|
_this.stringTags = {};
|
|
8876
|
+
_this.enabledMacros = {};
|
|
8876
8877
|
_this.destroyed = false;
|
|
8877
8878
|
_this.initialized = false;
|
|
8878
8879
|
if (props) {
|
|
@@ -16389,6 +16390,9 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16389
16390
|
return _this;
|
|
16390
16391
|
}
|
|
16391
16392
|
var _proto = ParticleSystem.prototype;
|
|
16393
|
+
_proto.isFrozen = function isFrozen() {
|
|
16394
|
+
return this.frozen;
|
|
16395
|
+
};
|
|
16392
16396
|
_proto.initEmitterTransform = function initEmitterTransform() {
|
|
16393
16397
|
var position = this.item.transform.position.clone();
|
|
16394
16398
|
var rotation = this.item.transform.rotation.clone();
|
|
@@ -16522,6 +16526,7 @@ var ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
16522
16526
|
return b.reset();
|
|
16523
16527
|
});
|
|
16524
16528
|
this.frozen = false;
|
|
16529
|
+
this.ended = false;
|
|
16525
16530
|
};
|
|
16526
16531
|
_proto.onUpdate = function onUpdate(delta) {
|
|
16527
16532
|
var _this = this;
|
|
@@ -17305,10 +17310,7 @@ function randomArrItem(arr, keepArr) {
|
|
|
17305
17310
|
*/ var ParticleBehaviourPlayable = /*#__PURE__*/ function(Playable) {
|
|
17306
17311
|
_inherits(ParticleBehaviourPlayable, Playable);
|
|
17307
17312
|
function ParticleBehaviourPlayable() {
|
|
17308
|
-
|
|
17309
|
-
_this = Playable.apply(this, arguments) || this;
|
|
17310
|
-
_this.lastTime = 0;
|
|
17311
|
-
return _this;
|
|
17313
|
+
return Playable.apply(this, arguments);
|
|
17312
17314
|
}
|
|
17313
17315
|
var _proto = ParticleBehaviourPlayable.prototype;
|
|
17314
17316
|
_proto.start = function start(context) {
|
|
@@ -17333,13 +17335,11 @@ function randomArrItem(arr, keepArr) {
|
|
|
17333
17335
|
// particleSystem.setParentTransform(parentItem.transform);
|
|
17334
17336
|
particleSystem.setVisible(true);
|
|
17335
17337
|
var deltaTime = context.deltaTime;
|
|
17336
|
-
|
|
17337
|
-
|
|
17338
|
-
deltaTime = 0;
|
|
17338
|
+
if (this.time < particleSystem.item.duration && particleSystem.isFrozen()) {
|
|
17339
|
+
particleSystem.reset();
|
|
17339
17340
|
}
|
|
17340
17341
|
particleSystem.onUpdate(deltaTime);
|
|
17341
17342
|
}
|
|
17342
|
-
this.lastTime = this.time;
|
|
17343
17343
|
};
|
|
17344
17344
|
return ParticleBehaviourPlayable;
|
|
17345
17345
|
}(Playable);
|
|
@@ -18719,9 +18719,9 @@ var AnimationClipPlayable = /*#__PURE__*/ function(Playable) {
|
|
|
18719
18719
|
var localTime = time - this.start;
|
|
18720
18720
|
var duration = this.duration;
|
|
18721
18721
|
if (localTime - duration > 0.001) {
|
|
18722
|
-
if (this.
|
|
18722
|
+
if (this.endBehavior === ItemEndBehavior.loop) {
|
|
18723
18723
|
localTime = localTime % duration;
|
|
18724
|
-
} else if (this.
|
|
18724
|
+
} else if (this.endBehavior === ItemEndBehavior.freeze) {
|
|
18725
18725
|
localTime = Math.min(duration, localTime);
|
|
18726
18726
|
}
|
|
18727
18727
|
}
|
|
@@ -18846,9 +18846,9 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
18846
18846
|
var weight = 1.0;
|
|
18847
18847
|
var ended = false;
|
|
18848
18848
|
var started = false;
|
|
18849
|
-
var
|
|
18850
|
-
if (localTime > clip.start + clip.duration + 0.001 && clip.
|
|
18851
|
-
if (VFXItem.isParticle(
|
|
18849
|
+
var boundObject = this.track.binding;
|
|
18850
|
+
if (localTime > clip.start + clip.duration + 0.001 && clip.endBehavior === ItemEndBehavior.destroy) {
|
|
18851
|
+
if (_instanceof1(boundObject, VFXItem) && VFXItem.isParticle(boundObject) && this.particleSystem && !this.particleSystem.destroyed) {
|
|
18852
18852
|
weight = 1.0;
|
|
18853
18853
|
} else {
|
|
18854
18854
|
weight = 0.0;
|
|
@@ -18865,25 +18865,22 @@ var RuntimeClip = /*#__PURE__*/ function() {
|
|
|
18865
18865
|
}
|
|
18866
18866
|
this.parentMixer.setInputWeight(this.playable, weight);
|
|
18867
18867
|
// 判断动画是否结束
|
|
18868
|
-
if (ended
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
18872
|
-
|
|
18873
|
-
|
|
18874
|
-
|
|
18868
|
+
if (ended) {
|
|
18869
|
+
if (_instanceof1(boundObject, VFXItem) && !boundObject.ended) {
|
|
18870
|
+
boundObject.ended = true;
|
|
18871
|
+
boundObject.onEnd();
|
|
18872
|
+
if (!boundObject.compositionReusable && !boundObject.reusable) {
|
|
18873
|
+
boundObject.dispose();
|
|
18874
|
+
this.playable.dispose();
|
|
18875
|
+
}
|
|
18876
|
+
}
|
|
18877
|
+
if (this.playable.getPlayState() === PlayState.Playing) {
|
|
18878
|
+
this.playable.pause();
|
|
18879
|
+
}
|
|
18875
18880
|
}
|
|
18876
18881
|
var clipTime = clip.toLocalTime(localTime);
|
|
18877
18882
|
this.playable.setTime(clipTime);
|
|
18878
18883
|
};
|
|
18879
|
-
_proto.onClipEnd = function onClipEnd() {
|
|
18880
|
-
var boundItem = this.track.binding;
|
|
18881
|
-
if (!boundItem.compositionReusable && !boundItem.reusable) {
|
|
18882
|
-
boundItem.dispose();
|
|
18883
|
-
this.playable.dispose();
|
|
18884
|
-
return;
|
|
18885
|
-
}
|
|
18886
|
-
};
|
|
18887
18884
|
_create_class(RuntimeClip, [
|
|
18888
18885
|
{
|
|
18889
18886
|
key: "enable",
|
|
@@ -18915,7 +18912,7 @@ var ObjectBindingTrack = /*#__PURE__*/ function(TrackAsset1) {
|
|
|
18915
18912
|
var particleClip = particleTrack.createClip(ParticleBehaviourPlayableAsset);
|
|
18916
18913
|
particleClip.start = boundItem.start;
|
|
18917
18914
|
particleClip.duration = boundItem.duration;
|
|
18918
|
-
particleClip.
|
|
18915
|
+
particleClip.endBehavior = boundItem.endBehavior;
|
|
18919
18916
|
}
|
|
18920
18917
|
};
|
|
18921
18918
|
return ObjectBindingTrack;
|
|
@@ -19216,7 +19213,7 @@ function compareTracks(a, b) {
|
|
|
19216
19213
|
if (!props) {
|
|
19217
19214
|
throw new Error("Referenced precomposition with Id: " + refId + " does not exist.");
|
|
19218
19215
|
}
|
|
19219
|
-
//
|
|
19216
|
+
// endBehavior 类型需优化
|
|
19220
19217
|
props.content = itemData.content;
|
|
19221
19218
|
item = assetLoader.loadGUID(itemData.id);
|
|
19222
19219
|
item.composition = this.item.composition;
|
|
@@ -22228,7 +22225,7 @@ function getStandardCameraContent(model) {
|
|
|
22228
22225
|
*/ function version30Migration(json) {
|
|
22229
22226
|
var _loop = function() {
|
|
22230
22227
|
var composition = _step1.value;
|
|
22231
|
-
// composition 的
|
|
22228
|
+
// composition 的 endBehavior 兼容
|
|
22232
22229
|
if (composition.endBehavior === CompositionEndBehavior.pause_destroy || composition.endBehavior === CompositionEndBehavior.pause) {
|
|
22233
22230
|
composition.endBehavior = END_BEHAVIOR_FREEZE;
|
|
22234
22231
|
}
|
|
@@ -22614,7 +22611,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22614
22611
|
{
|
|
22615
22612
|
start: item.delay,
|
|
22616
22613
|
duration: item.duration,
|
|
22617
|
-
|
|
22614
|
+
endBehavior: item.endBehavior,
|
|
22618
22615
|
asset: {
|
|
22619
22616
|
id: newActivationPlayableAsset.id
|
|
22620
22617
|
}
|
|
@@ -22645,7 +22642,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22645
22642
|
{
|
|
22646
22643
|
start: item.delay,
|
|
22647
22644
|
duration: item.duration,
|
|
22648
|
-
|
|
22645
|
+
endBehavior: item.endBehavior,
|
|
22649
22646
|
asset: {
|
|
22650
22647
|
id: newTransformPlayableAssetData.id
|
|
22651
22648
|
}
|
|
@@ -22673,7 +22670,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22673
22670
|
{
|
|
22674
22671
|
start: item.delay,
|
|
22675
22672
|
duration: item.duration,
|
|
22676
|
-
|
|
22673
|
+
endBehavior: item.endBehavior,
|
|
22677
22674
|
asset: {
|
|
22678
22675
|
id: newSpriteColorPlayableAssetData.id
|
|
22679
22676
|
}
|
|
@@ -22699,7 +22696,7 @@ function convertTimelineAsset(composition, guidToItemMap, jsonScene) {
|
|
|
22699
22696
|
{
|
|
22700
22697
|
start: item.delay,
|
|
22701
22698
|
duration: item.duration,
|
|
22702
|
-
|
|
22699
|
+
endBehavior: item.endBehavior,
|
|
22703
22700
|
asset: {
|
|
22704
22701
|
id: newSubCompositionPlayableAssetData.id
|
|
22705
22702
|
}
|
|
@@ -24041,7 +24038,7 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24041
24038
|
function Camera(name, options) {
|
|
24042
24039
|
if (options === void 0) options = {};
|
|
24043
24040
|
this.name = name;
|
|
24044
|
-
this.
|
|
24041
|
+
this.viewportMatrix = Matrix4.fromIdentity();
|
|
24045
24042
|
this.viewMatrix = Matrix4.fromIdentity();
|
|
24046
24043
|
this.projectionMatrix = Matrix4.fromIdentity();
|
|
24047
24044
|
this.viewProjectionMatrix = Matrix4.fromIdentity();
|
|
@@ -24069,12 +24066,12 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24069
24066
|
this.updateMatrix();
|
|
24070
24067
|
}
|
|
24071
24068
|
var _proto = Camera.prototype;
|
|
24072
|
-
_proto.
|
|
24073
|
-
this.
|
|
24069
|
+
_proto.setViewportMatrix = function setViewportMatrix(matrix) {
|
|
24070
|
+
this.viewportMatrix = matrix.clone();
|
|
24074
24071
|
this.dirty = true;
|
|
24075
24072
|
};
|
|
24076
|
-
_proto.
|
|
24077
|
-
return this.
|
|
24073
|
+
_proto.getViewportMatrix = function getViewportMatrix() {
|
|
24074
|
+
return this.viewportMatrix;
|
|
24078
24075
|
};
|
|
24079
24076
|
/**
|
|
24080
24077
|
* 获取相机的视图变换矩阵
|
|
@@ -24196,7 +24193,8 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24196
24193
|
*/ _proto.updateMatrix = function updateMatrix() {
|
|
24197
24194
|
if (this.dirty) {
|
|
24198
24195
|
var _this_options = this.options, fov = _this_options.fov, aspect = _this_options.aspect, near = _this_options.near, far = _this_options.far, clipMode = _this_options.clipMode, position = _this_options.position;
|
|
24199
|
-
this.projectionMatrix.perspective(fov * DEG2RAD
|
|
24196
|
+
this.projectionMatrix.perspective(fov * DEG2RAD, aspect, near, far, clipMode === CameraClipMode.portrait);
|
|
24197
|
+
this.projectionMatrix.premultiply(this.viewportMatrix);
|
|
24200
24198
|
this.inverseViewMatrix.compose(position, this.getQuat(), tmpScale);
|
|
24201
24199
|
this.viewMatrix.copyFrom(this.inverseViewMatrix).invert();
|
|
24202
24200
|
this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix, this.viewMatrix);
|
|
@@ -25311,12 +25309,12 @@ var listOrder = 0;
|
|
|
25311
25309
|
}
|
|
25312
25310
|
},
|
|
25313
25311
|
{
|
|
25314
|
-
key: "
|
|
25312
|
+
key: "viewportMatrix",
|
|
25315
25313
|
get: function get() {
|
|
25316
|
-
return this.camera.
|
|
25314
|
+
return this.camera.getViewportMatrix();
|
|
25317
25315
|
},
|
|
25318
|
-
set: function set(
|
|
25319
|
-
this.camera.
|
|
25316
|
+
set: function set(matrix) {
|
|
25317
|
+
this.camera.setViewportMatrix(matrix);
|
|
25320
25318
|
}
|
|
25321
25319
|
}
|
|
25322
25320
|
]);
|
|
@@ -25715,7 +25713,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
25715
25713
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
25716
25714
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
25717
25715
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
25718
|
-
var version$1 = "2.0.0-alpha.
|
|
25716
|
+
var version$1 = "2.0.0-alpha.25";
|
|
25719
25717
|
logger.info("Core version: " + version$1 + ".");
|
|
25720
25718
|
|
|
25721
25719
|
var _obj;
|
|
@@ -27348,7 +27346,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
27348
27346
|
*/ Mesh.create = function(engine, props) {
|
|
27349
27347
|
return new ThreeMesh(engine, props);
|
|
27350
27348
|
};
|
|
27351
|
-
var version = "2.0.0-alpha.
|
|
27349
|
+
var version = "2.0.0-alpha.25";
|
|
27352
27350
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
27353
27351
|
|
|
27354
27352
|
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, Engine, 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, 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, createVFXItem, 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, isObject, isSceneJSON, isSceneURL, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, 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 };
|