@galacean/effects-core 2.0.0-alpha.25 → 2.0.0-alpha.26
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/decorators.d.ts +1 -1
- package/dist/index.js +89 -73
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -73
- package/dist/index.mjs.map +1 -1
- 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.26
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -4489,8 +4489,8 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
4489
4489
|
BuiltinObjectGUID: BuiltinObjectGUID
|
|
4490
4490
|
});
|
|
4491
4491
|
|
|
4492
|
-
var decoratorInitialStore =
|
|
4493
|
-
var mergedStore =
|
|
4492
|
+
var decoratorInitialStore = new Map();
|
|
4493
|
+
var mergedStore = new Map();
|
|
4494
4494
|
var effectsClassStore = {};
|
|
4495
4495
|
function effectsClass(className) {
|
|
4496
4496
|
return function(target, context) {
|
|
@@ -4505,22 +4505,22 @@ function serialize(type, sourceName) {
|
|
|
4505
4505
|
return generateSerializableMember(type, sourceName); // value member
|
|
4506
4506
|
}
|
|
4507
4507
|
function getMergedStore(target) {
|
|
4508
|
-
var classKey = target.constructor
|
|
4509
|
-
if (mergedStore
|
|
4510
|
-
return mergedStore
|
|
4508
|
+
var classKey = target.constructor;
|
|
4509
|
+
if (mergedStore.get(classKey)) {
|
|
4510
|
+
return mergedStore.get(classKey);
|
|
4511
4511
|
}
|
|
4512
|
-
|
|
4513
|
-
|
|
4512
|
+
var store = {};
|
|
4513
|
+
mergedStore.set(classKey, store);
|
|
4514
4514
|
var currentTarget = target;
|
|
4515
4515
|
var currentKey = classKey;
|
|
4516
4516
|
while(currentKey){
|
|
4517
|
-
var initialStore = decoratorInitialStore
|
|
4517
|
+
var initialStore = decoratorInitialStore.get(currentKey);
|
|
4518
4518
|
for(var property in initialStore){
|
|
4519
4519
|
store[property] = initialStore[property];
|
|
4520
4520
|
}
|
|
4521
4521
|
var parent = Object.getPrototypeOf(currentTarget);
|
|
4522
|
-
currentKey = Object.getPrototypeOf(parent).constructor
|
|
4523
|
-
if (currentKey ===
|
|
4522
|
+
currentKey = Object.getPrototypeOf(parent).constructor;
|
|
4523
|
+
if (currentKey === Object) {
|
|
4524
4524
|
break;
|
|
4525
4525
|
}
|
|
4526
4526
|
currentTarget = parent;
|
|
@@ -4530,6 +4530,9 @@ function getMergedStore(target) {
|
|
|
4530
4530
|
function generateSerializableMember(type, sourceName) {
|
|
4531
4531
|
return function(target, propertyKey) {
|
|
4532
4532
|
var classStore = getDirectStore(target);
|
|
4533
|
+
if (!classStore) {
|
|
4534
|
+
return;
|
|
4535
|
+
}
|
|
4533
4536
|
if (!classStore[propertyKey]) {
|
|
4534
4537
|
classStore[propertyKey] = {
|
|
4535
4538
|
type: type,
|
|
@@ -4539,11 +4542,11 @@ function generateSerializableMember(type, sourceName) {
|
|
|
4539
4542
|
};
|
|
4540
4543
|
}
|
|
4541
4544
|
function getDirectStore(target) {
|
|
4542
|
-
var classKey = target.constructor
|
|
4543
|
-
if (!decoratorInitialStore
|
|
4544
|
-
decoratorInitialStore
|
|
4545
|
+
var classKey = target.constructor;
|
|
4546
|
+
if (!decoratorInitialStore.get(classKey)) {
|
|
4547
|
+
decoratorInitialStore.set(classKey, {});
|
|
4545
4548
|
}
|
|
4546
|
-
return decoratorInitialStore
|
|
4549
|
+
return decoratorInitialStore.get(classKey);
|
|
4547
4550
|
}
|
|
4548
4551
|
|
|
4549
4552
|
/**
|
|
@@ -19665,7 +19668,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19665
19668
|
_proto.updateWithOptions = function updateWithOptions(options) {
|
|
19666
19669
|
this.textStyle = new TextStyle(options);
|
|
19667
19670
|
this.textLayout = new TextLayout(options);
|
|
19668
|
-
this.text = options.text;
|
|
19671
|
+
this.text = options.text.toString();
|
|
19669
19672
|
this.lineCount = this.getLineCount(options.text, true);
|
|
19670
19673
|
};
|
|
19671
19674
|
_proto.getLineCount = function getLineCount(text, init) {
|
|
@@ -19736,7 +19739,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
19736
19739
|
if (this.text === value) {
|
|
19737
19740
|
return;
|
|
19738
19741
|
}
|
|
19739
|
-
this.text = value;
|
|
19742
|
+
this.text = value.toString();
|
|
19740
19743
|
this.lineCount = this.getLineCount(value, false);
|
|
19741
19744
|
this.isDirty = true;
|
|
19742
19745
|
};
|
|
@@ -20845,29 +20848,31 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20845
20848
|
effectsObject.toData();
|
|
20846
20849
|
res[effectsObject.getInstanceId()] = effectsObject;
|
|
20847
20850
|
var serializedProperties = getMergedStore(effectsObject);
|
|
20848
|
-
|
|
20849
|
-
var
|
|
20850
|
-
|
|
20851
|
-
|
|
20852
|
-
|
|
20853
|
-
value
|
|
20854
|
-
|
|
20855
|
-
if (EffectsObject.is(value)) {
|
|
20856
|
-
SerializationHelper.collectSerializableObject(value, res);
|
|
20857
|
-
} else if (isArray(value)) {
|
|
20858
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose(value), _step1; !(_step1 = _iterator1()).done;){
|
|
20859
|
-
var arrayValue = _step1.value;
|
|
20860
|
-
if (EffectsObject.is(arrayValue)) {
|
|
20861
|
-
SerializationHelper.collectSerializableObject(arrayValue, res);
|
|
20862
|
-
}
|
|
20851
|
+
if (serializedProperties) {
|
|
20852
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
20853
|
+
var key = _step.value;
|
|
20854
|
+
// TODO 待移除,序列化属性通过 effectsObject 对象直接获取
|
|
20855
|
+
var value = effectsObject.taggedProperties[key];
|
|
20856
|
+
if (value === undefined) {
|
|
20857
|
+
value = effectsObject[key];
|
|
20863
20858
|
}
|
|
20864
|
-
|
|
20865
|
-
|
|
20866
|
-
|
|
20867
|
-
var
|
|
20868
|
-
|
|
20869
|
-
|
|
20870
|
-
|
|
20859
|
+
if (EffectsObject.is(value)) {
|
|
20860
|
+
SerializationHelper.collectSerializableObject(value, res);
|
|
20861
|
+
} else if (isArray(value)) {
|
|
20862
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(value), _step1; !(_step1 = _iterator1()).done;){
|
|
20863
|
+
var arrayValue = _step1.value;
|
|
20864
|
+
if (EffectsObject.is(arrayValue)) {
|
|
20865
|
+
SerializationHelper.collectSerializableObject(arrayValue, res);
|
|
20866
|
+
}
|
|
20867
|
+
}
|
|
20868
|
+
} else if (isObject(value)) {
|
|
20869
|
+
// 非 EffectsObject 对象只递归一层
|
|
20870
|
+
for(var _iterator2 = _create_for_of_iterator_helper_loose(Object.keys(value)), _step2; !(_step2 = _iterator2()).done;){
|
|
20871
|
+
var objectKey = _step2.value;
|
|
20872
|
+
var objectValue = value[objectKey];
|
|
20873
|
+
if (EffectsObject.is(objectValue)) {
|
|
20874
|
+
SerializationHelper.collectSerializableObject(objectValue, res);
|
|
20875
|
+
}
|
|
20871
20876
|
}
|
|
20872
20877
|
}
|
|
20873
20878
|
}
|
|
@@ -20898,27 +20903,29 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20898
20903
|
serializedData = {};
|
|
20899
20904
|
}
|
|
20900
20905
|
var serializedProperties = getMergedStore(effectsObject);
|
|
20901
|
-
|
|
20902
|
-
var
|
|
20903
|
-
|
|
20904
|
-
|
|
20905
|
-
|
|
20906
|
-
|
|
20907
|
-
|
|
20908
|
-
if (
|
|
20909
|
-
serializedData[key]
|
|
20910
|
-
|
|
20911
|
-
|
|
20912
|
-
|
|
20913
|
-
|
|
20914
|
-
|
|
20915
|
-
|
|
20916
|
-
|
|
20917
|
-
|
|
20918
|
-
if (
|
|
20919
|
-
serializedData[key]
|
|
20906
|
+
if (serializedProperties) {
|
|
20907
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step; !(_step = _iterator()).done;){
|
|
20908
|
+
var key = _step.value;
|
|
20909
|
+
var value = effectsObject[key];
|
|
20910
|
+
if (typeof value === "number" || typeof value === "string" || typeof value === "boolean" || SerializationHelper.checkTypedArray(value)) {
|
|
20911
|
+
// TODO json 数据避免传 typedArray
|
|
20912
|
+
serializedData[key] = value;
|
|
20913
|
+
} else if (isArray(value)) {
|
|
20914
|
+
if (!serializedData[key]) {
|
|
20915
|
+
serializedData[key] = [];
|
|
20916
|
+
}
|
|
20917
|
+
SerializationHelper.serializeArrayProperty(value, serializedData[key], 0);
|
|
20918
|
+
} else if (EffectsObject.is(value)) {
|
|
20919
|
+
// TODO 处理 EffectsObject 递归序列化
|
|
20920
|
+
serializedData[key] = {
|
|
20921
|
+
id: value.getInstanceId()
|
|
20922
|
+
};
|
|
20923
|
+
} else if (isObject(value)) {
|
|
20924
|
+
if (!serializedData[key]) {
|
|
20925
|
+
serializedData[key] = {};
|
|
20926
|
+
}
|
|
20927
|
+
SerializationHelper.serializeObjectProperty(value, serializedData[key], 0);
|
|
20920
20928
|
}
|
|
20921
|
-
SerializationHelper.serializeObjectProperty(value, serializedData[key], 0);
|
|
20922
20929
|
}
|
|
20923
20930
|
}
|
|
20924
20931
|
// TODO 待移除 tagggedProperties 为没有装饰器的临时方案
|
|
@@ -20953,22 +20960,24 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20953
20960
|
var engine = effectsObject.engine;
|
|
20954
20961
|
for(var _iterator = _create_for_of_iterator_helper_loose(Object.keys(serializedData)), _step; !(_step = _iterator()).done;){
|
|
20955
20962
|
var key = _step.value;
|
|
20956
|
-
if (serializedProperties[key]) {
|
|
20963
|
+
if (serializedProperties && serializedProperties[key]) {
|
|
20957
20964
|
continue;
|
|
20958
20965
|
}
|
|
20959
20966
|
var value = serializedData[key];
|
|
20960
20967
|
taggedProperties[key] = SerializationHelper.deserializeProperty(value, engine, 0);
|
|
20961
20968
|
}
|
|
20962
|
-
|
|
20963
|
-
var
|
|
20964
|
-
|
|
20965
|
-
|
|
20966
|
-
|
|
20969
|
+
if (serializedProperties) {
|
|
20970
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties)), _step1; !(_step1 = _iterator1()).done;){
|
|
20971
|
+
var key1 = _step1.value;
|
|
20972
|
+
var value1 = serializedData[key1];
|
|
20973
|
+
if (value1 === undefined) {
|
|
20974
|
+
continue;
|
|
20975
|
+
}
|
|
20976
|
+
var propertyType = serializedProperties[key1].type;
|
|
20977
|
+
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
20978
|
+
// @ts-expect-error
|
|
20979
|
+
effectsObject[key1] = SerializationHelper.deserializeProperty(value1, engine, 0, propertyType);
|
|
20967
20980
|
}
|
|
20968
|
-
var propertyType = serializedProperties[key1].type;
|
|
20969
|
-
// FIXME: taggedProperties 为 readonly,这里存在强制赋值
|
|
20970
|
-
// @ts-expect-error
|
|
20971
|
-
effectsObject[key1] = SerializationHelper.deserializeProperty(value1, engine, 0, propertyType);
|
|
20972
20981
|
}
|
|
20973
20982
|
effectsObject.fromData(taggedProperties);
|
|
20974
20983
|
};
|
|
@@ -20989,7 +20998,7 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
20989
20998
|
4
|
|
20990
20999
|
];
|
|
20991
21000
|
key = _step.value;
|
|
20992
|
-
if (serializedProperties[key]) {
|
|
21001
|
+
if (serializedProperties && serializedProperties[key]) {
|
|
20993
21002
|
return [
|
|
20994
21003
|
3,
|
|
20995
21004
|
3
|
|
@@ -21009,6 +21018,10 @@ var SerializationHelper = /*#__PURE__*/ function() {
|
|
|
21009
21018
|
1
|
|
21010
21019
|
];
|
|
21011
21020
|
case 4:
|
|
21021
|
+
if (!serializedProperties) return [
|
|
21022
|
+
3,
|
|
21023
|
+
8
|
|
21024
|
+
];
|
|
21012
21025
|
_iterator1 = _create_for_of_iterator_helper_loose(Object.keys(serializedProperties));
|
|
21013
21026
|
_state.label = 5;
|
|
21014
21027
|
case 5:
|
|
@@ -24128,11 +24141,13 @@ var tmpScale = new Vector3(1, 1, 1);
|
|
|
24128
24141
|
* 获取归一化坐标和 3D 世界坐标的换算比例
|
|
24129
24142
|
* @param z - 当前的位置 z
|
|
24130
24143
|
*/ _proto.getInverseVPRatio = function getInverseVPRatio(z) {
|
|
24131
|
-
var pos = new Vector3(
|
|
24144
|
+
var pos = new Vector3(this.position.x, this.position.y, z);
|
|
24132
24145
|
var mat = this.getViewProjectionMatrix();
|
|
24133
24146
|
var inverseVP = this.getInverseViewProjectionMatrix();
|
|
24134
24147
|
var _mat_projectPoint = mat.projectPoint(pos), nz = _mat_projectPoint.z;
|
|
24135
|
-
|
|
24148
|
+
var _inverseVP_projectPoint = inverseVP.projectPoint(new Vector3(1, 1, nz)), xMax = _inverseVP_projectPoint.x, yMax = _inverseVP_projectPoint.y;
|
|
24149
|
+
var _inverseVP_projectPoint1 = inverseVP.projectPoint(new Vector3(-1, -1, nz)), xMin = _inverseVP_projectPoint1.x, yMin = _inverseVP_projectPoint1.y;
|
|
24150
|
+
return new Vector3((xMax - xMin) / 2, (yMax - yMin) / 2, 0);
|
|
24136
24151
|
};
|
|
24137
24152
|
/**
|
|
24138
24153
|
* 设置相机的旋转四元数
|
|
@@ -24785,6 +24800,7 @@ var listOrder = 0;
|
|
|
24785
24800
|
// this.extraCamera?.getComponent(TimelineComponent)?.update(deltaTime);
|
|
24786
24801
|
this.updateCamera();
|
|
24787
24802
|
if (this.shouldDispose()) {
|
|
24803
|
+
this.onEnd == null ? void 0 : this.onEnd.call(this, this);
|
|
24788
24804
|
this.dispose();
|
|
24789
24805
|
} else {
|
|
24790
24806
|
if (!skipRender) {
|
|
@@ -25711,7 +25727,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem, true);
|
|
|
25711
25727
|
registerPlugin("particle", ParticleLoader, VFXItem, true);
|
|
25712
25728
|
registerPlugin("cal", CalculateLoader, VFXItem, true);
|
|
25713
25729
|
registerPlugin("interact", InteractLoader, VFXItem, true);
|
|
25714
|
-
var version = "2.0.0-alpha.
|
|
25730
|
+
var version = "2.0.0-alpha.26";
|
|
25715
25731
|
logger.info("Core version: " + version + ".");
|
|
25716
25732
|
|
|
25717
25733
|
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, 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, 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, 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, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version, vertexFormatType2GLType };
|