@galacean/effects-specification 2.0.0-alpha.13 → 2.0.0-alpha.15

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.
@@ -1,8 +1,8 @@
1
1
  import type { EffectsObjectData } from './components';
2
- import type { FixedNumberExpression, FixedVec3Expression } from './number-expression';
2
+ import type { FixedNumberExpression, FixedVec3Expression, FixedQuatExpression } from './number-expression';
3
3
  export interface AnimationClipData extends EffectsObjectData {
4
4
  positionCurves: PositionCurveData[];
5
- eulerCurves: EulerCurveData[];
5
+ rotationCurves: RotationCurveData[];
6
6
  scaleCurves: ScaleCurveData[];
7
7
  floatCurves: FloatCurveData[];
8
8
  }
@@ -10,9 +10,9 @@ export interface PositionCurveData {
10
10
  path: string;
11
11
  keyFrames: FixedVec3Expression;
12
12
  }
13
- export interface EulerCurveData {
13
+ export interface RotationCurveData {
14
14
  path: string;
15
- keyFrames: FixedVec3Expression;
15
+ keyFrames: FixedQuatExpression;
16
16
  }
17
17
  export interface ScaleCurveData {
18
18
  path: string;
@@ -12,12 +12,18 @@ export declare enum DataType {
12
12
  Texture = "Texture",
13
13
  AnimationClip = "AnimationClip",
14
14
  TextComponent = "TextComponent",
15
+ TrackAsset = "TrackAsset",
16
+ TimelineAsset = "TimelineAsset",
17
+ TransformPlayableAsset = "TransformPlayableAsset",
18
+ SpriteColorPlayableAsset = "SpriteColorPlayableAsset",
15
19
  MeshComponent = "MeshComponent",
16
20
  SkyboxComponent = "SkyboxComponent",
17
21
  LightComponent = "LightComponent",
18
22
  CameraComponent = "CameraComponent",
19
23
  ModelPluginComponent = "ModelPluginComponent",
20
- TreeComponent = "TreeComponent"
24
+ TreeComponent = "TreeComponent",
25
+ AnimationComponent = "AnimationComponent",
26
+ TimelineClip = "TimelineClip"
21
27
  }
22
28
  export interface DataPath {
23
29
  id: string;
@@ -62,7 +68,7 @@ export interface MaterialData extends EffectsObjectData {
62
68
  }
63
69
  export interface GeometryData extends EffectsObjectData {
64
70
  vertexData: VertexData;
65
- indexFormat: number;
71
+ indexFormat: IndexFormatType;
66
72
  indexOffset: number;
67
73
  subMeshes: SubMesh[];
68
74
  /**
@@ -81,7 +87,7 @@ export interface GeometryData extends EffectsObjectData {
81
87
  rootBoneName?: string;
82
88
  inverseBindMatrices?: number[];
83
89
  }
84
- interface SubMesh {
90
+ export interface SubMesh {
85
91
  offset: number;
86
92
  indexCount?: number;
87
93
  vertexCount: number;
@@ -121,15 +127,20 @@ export interface VertexData {
121
127
  channels: VertexChannel[];
122
128
  }
123
129
  export declare enum VertexFormatType {
124
- Float32 = 0,
125
- Int16 = 1,
130
+ Float16 = 0,
131
+ Float32 = 1,
126
132
  Int8 = 2,
127
- UInt16 = 3,
128
- UInt8 = 4
133
+ Int16 = 3,
134
+ Int32 = 4,
135
+ UInt8 = 5,
136
+ UInt16 = 6,
137
+ UInt32 = 7
129
138
  }
130
139
  export declare enum IndexFormatType {
131
- UInt16 = 0,
132
- UInt32 = 1
140
+ None = -1,
141
+ UInt8 = 0,
142
+ UInt16 = 1,
143
+ UInt32 = 2
133
144
  }
134
145
  export interface VertexChannel {
135
146
  semantic: string;
@@ -182,4 +193,3 @@ export interface FileSummary {
182
193
  guid: string;
183
194
  assetType: string;
184
195
  }
185
- export {};
package/es/components.js CHANGED
@@ -12,6 +12,10 @@ export var DataType;
12
12
  DataType["Texture"] = "Texture";
13
13
  DataType["AnimationClip"] = "AnimationClip";
14
14
  DataType["TextComponent"] = "TextComponent";
15
+ DataType["TrackAsset"] = "TrackAsset";
16
+ DataType["TimelineAsset"] = "TimelineAsset";
17
+ DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
18
+ DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
15
19
  // FIXME: 先完成ECS的场景转换,后面移到spec中
16
20
  DataType["MeshComponent"] = "MeshComponent";
17
21
  DataType["SkyboxComponent"] = "SkyboxComponent";
@@ -19,6 +23,9 @@ export var DataType;
19
23
  DataType["CameraComponent"] = "CameraComponent";
20
24
  DataType["ModelPluginComponent"] = "ModelPluginComponent";
21
25
  DataType["TreeComponent"] = "TreeComponent";
26
+ DataType["AnimationComponent"] = "AnimationComponent";
27
+ // Non-EffectObject
28
+ DataType["TimelineClip"] = "TimelineClip";
22
29
  })(DataType || (DataType = {}));
23
30
  export var GeometryType;
24
31
  (function (GeometryType) {
@@ -53,16 +60,21 @@ export var GeometryType;
53
60
  })(GeometryType || (GeometryType = {}));
54
61
  export var VertexFormatType;
55
62
  (function (VertexFormatType) {
56
- VertexFormatType[VertexFormatType["Float32"] = 0] = "Float32";
57
- VertexFormatType[VertexFormatType["Int16"] = 1] = "Int16";
63
+ VertexFormatType[VertexFormatType["Float16"] = 0] = "Float16";
64
+ VertexFormatType[VertexFormatType["Float32"] = 1] = "Float32";
58
65
  VertexFormatType[VertexFormatType["Int8"] = 2] = "Int8";
59
- VertexFormatType[VertexFormatType["UInt16"] = 3] = "UInt16";
60
- VertexFormatType[VertexFormatType["UInt8"] = 4] = "UInt8";
66
+ VertexFormatType[VertexFormatType["Int16"] = 3] = "Int16";
67
+ VertexFormatType[VertexFormatType["Int32"] = 4] = "Int32";
68
+ VertexFormatType[VertexFormatType["UInt8"] = 5] = "UInt8";
69
+ VertexFormatType[VertexFormatType["UInt16"] = 6] = "UInt16";
70
+ VertexFormatType[VertexFormatType["UInt32"] = 7] = "UInt32";
61
71
  })(VertexFormatType || (VertexFormatType = {}));
62
72
  export var IndexFormatType;
63
73
  (function (IndexFormatType) {
64
- IndexFormatType[IndexFormatType["UInt16"] = 0] = "UInt16";
65
- IndexFormatType[IndexFormatType["UInt32"] = 1] = "UInt32";
74
+ IndexFormatType[IndexFormatType["None"] = -1] = "None";
75
+ IndexFormatType[IndexFormatType["UInt8"] = 0] = "UInt8";
76
+ IndexFormatType[IndexFormatType["UInt16"] = 1] = "UInt16";
77
+ IndexFormatType[IndexFormatType["UInt32"] = 2] = "UInt32";
66
78
  })(IndexFormatType || (IndexFormatType = {}));
67
79
  // BINORMAL[n] Binormal float4
68
80
  // BLENDINDICES[n] 混合索引 uint
@@ -1,5 +1,5 @@
1
- import type { Item } from './item';
2
1
  import type { DataPath } from './components';
2
+ import type { Item } from './item';
3
3
  export declare enum CameraClipMode {
4
4
  /**
5
5
  * 剪裁上下
@@ -157,4 +157,22 @@ export interface CompositionData {
157
157
  * 降级图
158
158
  */
159
159
  fallbackImage?: string;
160
+ /**
161
+ * 时间轴资产(TimelineAssetData)
162
+ */
163
+ timelineAsset: DataPath;
164
+ /**
165
+ * 轨道的场景绑定
166
+ */
167
+ sceneBindings: SceneBindingData[];
168
+ }
169
+ export interface SceneBindingData {
170
+ /**
171
+ * 绑定的轨道资产(TrackAssetData)
172
+ */
173
+ key: DataPath;
174
+ /**
175
+ * 被绑定的场景对象(VFXItemData)
176
+ */
177
+ value: DataPath;
160
178
  }
package/es/index.d.ts CHANGED
@@ -25,3 +25,4 @@ export * from './text';
25
25
  export * from './components';
26
26
  export * from './vfx-item-data';
27
27
  export * from './buitin-object-guid';
28
+ export * from './timeline';
package/es/index.js CHANGED
@@ -25,3 +25,4 @@ export * from './text';
25
25
  export * from './components';
26
26
  export * from './vfx-item-data';
27
27
  export * from './buitin-object-guid';
28
+ export * from './timeline';
@@ -85,3 +85,13 @@ export interface ModelAnimationComponentData extends ComponentData {
85
85
  */
86
86
  animations: ModelAnimationData[];
87
87
  }
88
+ export interface AnimationComponentData extends ComponentData {
89
+ /**
90
+ * 默认动画索引,-1表示不播放动画
91
+ */
92
+ animation?: number;
93
+ /**
94
+ * glTF中所有的动画数据
95
+ */
96
+ animationClips: DataPath[];
97
+ }
@@ -1,7 +1,6 @@
1
- import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, ItemType } from '../type';
2
1
  import type { RGBAColorValue } from '../number-expression';
2
+ import type { ColorOverLifetime, ItemType, PositionOverLifetime, RotationOverLifetime, SizeOverLifetime } from '../type';
3
3
  import type { BaseItem } from './base-item';
4
- import type { ComponentData, DataPath, EffectsObjectData } from '../components';
5
4
  /**
6
5
  * 空节点元素
7
6
  */
@@ -45,50 +44,3 @@ export interface NullContent {
45
44
  */
46
45
  colorOverLifetime?: ColorOverLifetime;
47
46
  }
48
- export interface TimelineComponentData extends ComponentData {
49
- /**
50
- * 轨道数据
51
- */
52
- tracks: TrackAssetData[];
53
- }
54
- export interface PlayableAssetData {
55
- dataType: string;
56
- }
57
- export interface TrackAssetData extends PlayableAssetData {
58
- clips: TimelineClipData[];
59
- }
60
- export interface TimelineClipData {
61
- start: number;
62
- duration: number;
63
- clipAsset: DataPath;
64
- }
65
- export interface TransformAnimationPlayableAssetData extends PlayableAssetData {
66
- animationClip: DataPath;
67
- }
68
- export interface SpriteColorAnimationPlayableAssetData extends PlayableAssetData {
69
- animationClip: DataPath;
70
- }
71
- export interface TransformAnimationClipData extends EffectsObjectData {
72
- /**
73
- * 空节点元素大小变化属性
74
- */
75
- sizeOverLifetime?: SizeOverLifetime;
76
- /**
77
- * 空节点元素旋转变化属性
78
- */
79
- rotationOverLifetime?: RotationOverLifetime;
80
- /**
81
- * 空节点元素位置变化属性
82
- */
83
- positionOverLifetime?: PositionOverLifetime;
84
- }
85
- export interface SpriteColorAnimationClipData extends EffectsObjectData {
86
- /**
87
- * 空节点元素色彩变化属性
88
- */
89
- colorOverLifetime?: ColorOverLifetime;
90
- /**
91
- * 图层初始颜色
92
- */
93
- startColor?: RGBAColorValue;
94
- }
@@ -68,6 +68,13 @@ export interface PluginSpineOption {
68
68
  * 动画播放的速度
69
69
  */
70
70
  speed?: number;
71
+ /**
72
+ * 使用的默认大小计算规则
73
+ * 0 :除以包围盒大小
74
+ * 1 : 相机逆投影 + 固定画布大小
75
+ * @since 1.3.0
76
+ */
77
+ resizeRule: number;
71
78
  }
72
79
  /**
73
80
  * spine资源信息
@@ -68,7 +68,11 @@ export declare enum ValueType {
68
68
  /**
69
69
  * 贝塞尔曲线路径
70
70
  */
71
- BEZIER_CURVE_PATH = 22
71
+ BEZIER_CURVE_PATH = 22,
72
+ /**
73
+ * 贝塞尔曲线四元数
74
+ */
75
+ BEZIER_CURVE_QUAT = 23
72
76
  }
73
77
  export type vec2 = [x: number, y: number];
74
78
  export type vec3 = [x: number, y: number, z: number];
@@ -109,6 +113,7 @@ export type FunctionExpression = LineValue | CurveValue | BezierValue;
109
113
  export type FixedNumberExpression = ConstantNumber | LineValue | CurveValue | BezierValue;
110
114
  export type NumberExpression = FixedNumberExpression | RandomValue;
111
115
  export type FixedVec3Expression = ConstantVec3 | BezierPath | LinearPath | BezierCurvePath;
116
+ export type FixedQuatExpression = BezierCurveQuat;
112
117
  /**
113
118
  * 常数数值
114
119
  * [0,5]
@@ -246,10 +251,18 @@ export type BezierValue = [type: ValueType.BEZIER_CURVE, value: BezierKeyframeVa
246
251
  * 贝塞尔曲线路径关键帧值
247
252
  */
248
253
  export type BezierCurvePathValue = [easing: BezierKeyframeValue[], points: vec3[], controlePoints: vec3[]];
254
+ /**
255
+ * 贝塞尔曲线路径关键帧值
256
+ */
257
+ export type BezierCurveQuatValue = [easing: BezierKeyframeValue[], points: vec4[], controlePoints: vec4[]];
249
258
  /**
250
259
  * 贝塞尔曲线路径关键帧
251
260
  */
252
261
  export type BezierCurvePath = [type: ValueType.BEZIER_CURVE_PATH, value: BezierCurvePathValue];
262
+ /**
263
+ * 贝塞尔曲线路径关键帧
264
+ */
265
+ export type BezierCurveQuat = [type: ValueType.BEZIER_CURVE_QUAT, value: BezierCurveQuatValue];
253
266
  /*********************************************/
254
267
  /*********************************************/
255
268
  export type ColorExpression = RGBAColor | GradientColor | RGBAColors;
@@ -71,6 +71,10 @@ export var ValueType;
71
71
  * 贝塞尔曲线路径
72
72
  */
73
73
  ValueType[ValueType["BEZIER_CURVE_PATH"] = 22] = "BEZIER_CURVE_PATH";
74
+ /**
75
+ * 贝塞尔曲线四元数
76
+ */
77
+ ValueType[ValueType["BEZIER_CURVE_QUAT"] = 23] = "BEZIER_CURVE_QUAT";
74
78
  })(ValueType || (ValueType = {}));
75
79
  /**
76
80
  * 关键帧类型
package/es/scene.d.ts CHANGED
@@ -6,6 +6,7 @@ import type { FontBase, FontDefine } from './text';
6
6
  import type { BinaryFile } from './binary';
7
7
  import type { ComponentData, GeometryData, MaterialData, ShaderData } from './components';
8
8
  import type { VFXItemData } from './vfx-item-data';
9
+ import type { AnimationClipData } from './animation-clip-data';
9
10
  /**
10
11
  * runtime 2.0 之前的场景信息
11
12
  * 素材信息存放于统一数据结构中
@@ -188,4 +189,8 @@ export interface JSONScene {
188
189
  * 几何体数据
189
190
  */
190
191
  geometries: GeometryData[];
192
+ /**
193
+ * 动画数据
194
+ */
195
+ animations: AnimationClipData[];
191
196
  }
@@ -0,0 +1,5 @@
1
+ export * from './track/track-asset-data';
2
+ export * from './sprite-color-playable-asset-data';
3
+ export * from './timeline-asset-data';
4
+ export * from './timeline-clip-data';
5
+ export * from './transform-playable-asset-data';
@@ -0,0 +1,5 @@
1
+ export * from './track/track-asset-data';
2
+ export * from './sprite-color-playable-asset-data';
3
+ export * from './timeline-asset-data';
4
+ export * from './timeline-clip-data';
5
+ export * from './transform-playable-asset-data';
@@ -0,0 +1,7 @@
1
+ import type { EffectsObjectData } from '../components';
2
+ import type { RGBAColorValue } from '../number-expression';
3
+ import type { ColorOverLifetime } from '../type';
4
+ export interface SpriteColorPlayableAssetData extends EffectsObjectData {
5
+ colorOverLifetime?: ColorOverLifetime;
6
+ startColor?: RGBAColorValue;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { EffectsObjectData, DataPath } from '../components';
2
+ export interface TimelineAssetData extends EffectsObjectData {
3
+ /**
4
+ * 轨道数据(TrackAssetData)
5
+ */
6
+ tracks: DataPath[];
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { DataPath } from '../components';
2
+ export interface TimelineClipData {
3
+ start?: number;
4
+ duration?: number;
5
+ /**
6
+ * 可播放资产(PlayableAssetData)
7
+ */
8
+ asset: DataPath;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { DataPath, EffectsObjectData } from '../../components';
2
+ import type { TimelineClipData } from '../timeline-clip-data';
3
+ export interface TrackAssetData extends EffectsObjectData {
4
+ /**
5
+ * 子轨道数据(TrackAssetData)
6
+ */
7
+ children: DataPath[];
8
+ clips: TimelineClipData;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { EffectsObjectData } from '../components';
2
+ import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime } from '../type';
3
+ export interface TransformPlayableAssetData extends EffectsObjectData {
4
+ /**
5
+ * 元素大小变化属性
6
+ */
7
+ sizeOverLifetime?: SizeOverLifetime;
8
+ /**
9
+ * 元素旋转变化属性
10
+ */
11
+ rotationOverLifetime?: RotationOverLifetime;
12
+ /**
13
+ * 元素位置变化属性
14
+ */
15
+ positionOverLifetime?: PositionOverLifetime;
16
+ }
@@ -0,0 +1 @@
1
+ export {};
package/es/type.d.ts CHANGED
@@ -539,7 +539,11 @@ export declare enum ItemType {
539
539
  /**
540
540
  * 特效元素
541
541
  */
542
- effect = "effect"
542
+ effect = "effect",
543
+ /**
544
+ * 节点元素
545
+ */
546
+ node = "node"
543
547
  }
544
548
  /**
545
549
  * 渲染模式
package/es/type.js CHANGED
@@ -260,6 +260,10 @@ export var ItemType;
260
260
  * 特效元素
261
261
  */
262
262
  ItemType["effect"] = "effect";
263
+ /**
264
+ * 节点元素
265
+ */
266
+ ItemType["node"] = "node";
263
267
  })(ItemType || (ItemType = {}));
264
268
  /**
265
269
  * 渲染模式
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-specification",
3
- "version": "2.0.0-alpha.13",
3
+ "version": "2.0.0-alpha.15",
4
4
  "description": "Galacean Effects JSON Specification",
5
5
  "module": "./es/index.js",
6
6
  "main": "./es/index.js",