@galacean/effects-plugin-model 2.0.0-alpha.12 → 2.0.0-alpha.13

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,10 +1,10 @@
1
- import type { HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, Engine, Renderer } from '@galacean/effects';
2
- import { ItemBehaviour, RendererComponent, TimelineComponent } from '@galacean/effects';
3
- import { Vector3 } from '../runtime/math';
4
- import type { Euler } from '../runtime/math';
5
- import type { ModelItemBounding, ModelMeshComponentData, ModelCameraComponentData, ModelSkyboxComponentData, ModelLightComponentData } from '../index';
1
+ import type { Engine, HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, Renderer, VFXItem } from '@galacean/effects';
2
+ import { ItemBehaviour, RendererComponent, AnimationClip } from '@galacean/effects';
3
+ import type { ModelCameraComponentData, ModelItemBounding, ModelLightComponentData, ModelMeshComponentData, ModelSkyboxComponentData, AnimationComponentData } from '../index';
6
4
  import type { PSceneManager } from '../runtime';
7
5
  import { PCamera, PLight, PMesh, PSkybox } from '../runtime';
6
+ import type { Euler } from '../runtime/math';
7
+ import { Vector3 } from '../runtime/math';
8
8
  /**
9
9
  * 插件 Mesh 组件类,支持 3D Mesh 渲染能力
10
10
  * @since 2.0.0
@@ -27,6 +27,10 @@ export declare class ModelMeshComponent extends RendererComponent {
27
27
  * 场景管理器
28
28
  */
29
29
  sceneManager?: PSceneManager;
30
+ /**
31
+ * morph 动画权重
32
+ */
33
+ morphWeights: number[];
30
34
  /**
31
35
  * 构造函数,只保存传入参数,不在这里创建内部对象
32
36
  * @param engine - 引擎
@@ -205,10 +209,6 @@ export declare class ModelCameraComponent extends ItemBehaviour {
205
209
  * 参数
206
210
  */
207
211
  data?: ModelCameraComponentData;
208
- /**
209
- * 时间轴组件
210
- */
211
- timeline?: TimelineComponent;
212
212
  /**
213
213
  * 构造函数,只保存传入参数,不在这里创建内部对象
214
214
  * @param engine - 引擎
@@ -248,3 +248,47 @@ export declare class ModelCameraComponent extends ItemBehaviour {
248
248
  */
249
249
  setTransform(position?: Vector3, rotation?: Euler): void;
250
250
  }
251
+ /**
252
+ * 插件动画组件类,支持 3D 动画能力
253
+ * @since 2.0.0
254
+ * @internal
255
+ */
256
+ export declare class AnimationComponent extends ItemBehaviour {
257
+ /**
258
+ * 参数
259
+ */
260
+ data?: AnimationComponentData;
261
+ elapsedTime: number;
262
+ animation: number;
263
+ clips: ModelAnimationClip[];
264
+ /**
265
+ * 构造函数,只保存传入参数,不在这里创建内部对象
266
+ * @param engine - 引擎
267
+ */
268
+ constructor(engine: Engine);
269
+ /**
270
+ * 组件开始,需要创建内部对象和添加到场景管理器中
271
+ */
272
+ start(): void;
273
+ /**
274
+ * 组件更新,更新内部对象状态
275
+ * @param dt - 更新间隔
276
+ */
277
+ update(dt: number): void;
278
+ /**
279
+ * 组件销毁
280
+ */
281
+ onDestroy(): void;
282
+ /**
283
+ * 反序列化,记录传入参数
284
+ * @param data - 组件参数
285
+ */
286
+ fromData(data: AnimationComponentData): void;
287
+ }
288
+ declare class ModelAnimationClip extends AnimationClip {
289
+ path2Node: Record<string, VFXItem>;
290
+ sampleAnimation(vfxItem: VFXItem, time: number): void;
291
+ setFromAnimationClip(clip: AnimationClip): void;
292
+ getTargetItem(rootItem: VFXItem, path: string): VFXItem;
293
+ }
294
+ export {};
@@ -1,6 +1,6 @@
1
- import { Transform, ItemBehaviour } from '@galacean/effects';
2
- import type { TimelineComponent, VFXItemContent, Engine, VFXItem } from '@galacean/effects';
3
- import type { ModelTreeOptions, ModelTreeContent } from '../index';
1
+ import type { Engine, VFXItem } from '@galacean/effects';
2
+ import { ItemBehaviour, Transform } from '@galacean/effects';
3
+ import type { ModelTreeContent, ModelTreeOptions } from '../index';
4
4
  import { PAnimationManager } from '../runtime';
5
5
  /**
6
6
  * 场景树节点描述
@@ -47,7 +47,7 @@ export declare class ModelTreeItem {
47
47
  * @param props - 场景树数据
48
48
  * @param owner - 场景树元素
49
49
  */
50
- constructor(props: ModelTreeOptions, owner: VFXItem<VFXItemContent>);
50
+ constructor(props: ModelTreeOptions, owner: VFXItem);
51
51
  /**
52
52
  * 场景树更新,主要是动画更新
53
53
  * @param dt - 时间间隔
@@ -96,10 +96,6 @@ export declare class ModelTreeComponent extends ItemBehaviour {
96
96
  * 参数
97
97
  */
98
98
  options?: ModelTreeContent;
99
- /**
100
- * 时间轴组件
101
- */
102
- timeline?: TimelineComponent;
103
99
  /**
104
100
  * 构造函数,创建节点树元素
105
101
  * @param engine
@@ -1,6 +1,6 @@
1
- import type { Geometry, Engine, VFXItemContent, VFXItem } from '@galacean/effects';
1
+ import type { Geometry, Engine, VFXItem, SkinProps } from '@galacean/effects';
2
2
  import { Texture } from '@galacean/effects';
3
- import type { ModelSkinOptions, ModelAnimTrackOptions, ModelAnimationOptions, ModelTreeOptions } from '../index';
3
+ import type { ModelAnimTrackOptions, ModelAnimationOptions, ModelTreeOptions } from '../index';
4
4
  import { Matrix4 } from './math';
5
5
  import { PObject } from './object';
6
6
  import type { PSceneManager } from './scene';
@@ -19,7 +19,7 @@ export declare class PSkin extends PObject {
19
19
  /**
20
20
  * 场景树父元素
21
21
  */
22
- parentItem?: VFXItem<VFXItemContent>;
22
+ rootBoneItem?: VFXItem;
23
23
  /**
24
24
  * 骨骼索引
25
25
  */
@@ -27,7 +27,7 @@ export declare class PSkin extends PObject {
27
27
  /**
28
28
  * 关节索引
29
29
  */
30
- jointList: number[];
30
+ jointItem: VFXItem[];
31
31
  /**
32
32
  * 逆绑定矩阵
33
33
  */
@@ -42,11 +42,11 @@ export declare class PSkin extends PObject {
42
42
  textureDataMode: TextureDataMode;
43
43
  /**
44
44
  * 创建蒙皮对象
45
- * @param options - 蒙皮相关数据
45
+ * @param props - 蒙皮相关数据
46
46
  * @param engine - 引擎对象
47
- * @param parentItem - 场景树父元素
47
+ * @param rootBoneItem - 场景树父元素
48
48
  */
49
- create(options: ModelSkinOptions, engine: Engine, parentItem?: VFXItem<VFXItemContent>): void;
49
+ create(props: SkinProps, engine: Engine, rootBoneItem: VFXItem): void;
50
50
  /**
51
51
  * 更新蒙皮矩阵
52
52
  */
@@ -62,7 +62,7 @@ export declare class PSkin extends PObject {
62
62
  * 更新父元素
63
63
  * @param parentItem - 场景树父元素
64
64
  */
65
- updateParentItem(parentItem: VFXItem<VFXItemContent>): void;
65
+ updateParentItem(parentItem: VFXItem): void;
66
66
  /**
67
67
  * 获取关节点数
68
68
  * @returns
@@ -78,6 +78,9 @@ export declare class PSkin extends PObject {
78
78
  */
79
79
  dispose(): void;
80
80
  private getTextureDataMode;
81
+ private getJointItems;
82
+ private genNodeName;
83
+ private genNodeNameDFS;
81
84
  }
82
85
  /**
83
86
  * Morph 动画类
@@ -95,7 +98,7 @@ export declare class PMorph extends PObject {
95
98
  * weights 数组的具体数据,来自动画控制器的每帧更新
96
99
  * 数组的长度必须和 morphWeightsLength 相同,否则会出错。
97
100
  */
98
- morphWeightsArray?: Float32Array;
101
+ morphWeightsArray: number[];
99
102
  /**
100
103
  * 是否有 Position 相关的 Morph 动画,shader 中需要知道
101
104
  */
@@ -114,12 +117,12 @@ export declare class PMorph extends PObject {
114
117
  * @returns 是否创建成功
115
118
  */
116
119
  create(geometry: Geometry): boolean;
117
- dispose(): void;
118
120
  /**
119
121
  * 初始化 Morph target 的权重数组
120
122
  * @param weights - glTF Mesh 的权重数组,长度必须严格一致
121
123
  */
122
124
  initWeights(weights: number[]): void;
125
+ updateWeights(weights: number[]): void;
123
126
  /**
124
127
  * 当前状态是否有 Morph 动画:
125
128
  * 需要判断 weights 数组长度,以及 Position、Normal 和 Tangent 是否有动画
@@ -133,7 +136,7 @@ export declare class PMorph extends PObject {
133
136
  * @returns 返回两个 Morph 动画状态是否相等
134
137
  */
135
138
  equals(morph: PMorph): boolean;
136
- getMorphWeightsArray(): Float32Array;
139
+ getMorphWeightsArray(): number[];
137
140
  /**
138
141
  * 统计 Geometry 中 Attribute 名称个数:
139
142
  * 主要用于统计 Morph 动画中新增的 Attribute 名称的个数,会作为最终的 weights 数组长度使用
@@ -216,7 +219,7 @@ export declare class PAnimTrack {
216
219
  * @param treeItem - 节点树元素
217
220
  * @param sceneManager - 3D 场景管理器
218
221
  */
219
- tick(time: number, treeItem: VFXItem<VFXItemContent>, sceneManager?: PSceneManager): void;
222
+ tick(time: number, treeItem: VFXItem, sceneManager?: PSceneManager): void;
220
223
  /**
221
224
  * 获取动画结束时间
222
225
  * @returns
@@ -290,7 +293,7 @@ export declare class PAnimation extends PObject {
290
293
  * @param treeItem - 场景树元素
291
294
  * @param sceneManager - 3D 场景管理器
292
295
  */
293
- tick(time: number, treeItem: VFXItem<VFXItemContent>, sceneManager?: PSceneManager): void;
296
+ tick(time: number, treeItem: VFXItem, sceneManager?: PSceneManager): void;
294
297
  /**
295
298
  * 销毁
296
299
  */
@@ -312,7 +315,7 @@ export declare class PAnimationManager extends PObject {
312
315
  * @param treeOptions - 场景树参数
313
316
  * @param ownerItem - 场景树所属元素
314
317
  */
315
- constructor(treeOptions: ModelTreeOptions, ownerItem: VFXItem<VFXItemContent>);
318
+ constructor(treeOptions: ModelTreeOptions, ownerItem: VFXItem);
316
319
  /**
317
320
  * 设置场景管理器
318
321
  * @param sceneManager - 场景管理器
@@ -337,5 +340,5 @@ export declare class PAnimationManager extends PObject {
337
340
  * 获取场景树元素
338
341
  * @returns
339
342
  */
340
- getTreeItem(): VFXItem<VFXItemContent>;
343
+ getTreeItem(): VFXItem;
341
344
  }
@@ -1,4 +1,4 @@
1
- import type { Engine, math, VFXItemContent, VFXItem, Renderer, Geometry } from '@galacean/effects';
1
+ import type { Engine, math, VFXItem, Renderer, Geometry } from '@galacean/effects';
2
2
  import { spec, Material } from '@galacean/effects';
3
3
  import type { ModelMeshComponentData } from '../index';
4
4
  import { PEntity } from './object';
@@ -26,11 +26,12 @@ export declare class PMesh extends PEntity {
26
26
  /**
27
27
  * 父元素
28
28
  */
29
- parentItem?: VFXItem<VFXItemContent>;
29
+ parentItem?: VFXItem;
30
30
  /**
31
31
  * 父元素索引
32
32
  */
33
33
  parentItemId?: string;
34
+ rootBoneItem?: VFXItem;
34
35
  /**
35
36
  * 蒙皮
36
37
  */
@@ -80,7 +81,7 @@ export declare class PMesh extends PEntity {
80
81
  * @param parentId - 父元素索引
81
82
  * @param parent - 父元素
82
83
  */
83
- constructor(engine: Engine, name: string, meshData: ModelMeshComponentData, owner?: ModelMeshComponent, parentId?: string, parent?: VFXItem<VFXItemContent>);
84
+ constructor(engine: Engine, name: string, meshData: ModelMeshComponentData, owner?: ModelMeshComponent, parentId?: string, parent?: VFXItem);
84
85
  /**
85
86
  * 创建 GE 的 Mesh、Geometry 和 Material 对象
86
87
  * @param scene - 场景管理器
@@ -115,7 +116,7 @@ export declare class PMesh extends PEntity {
115
116
  * @param parentId - 父元素索引
116
117
  * @param parentItem - 父 VFX 元素
117
118
  */
118
- updateParentInfo(parentId: string, parentItem: VFXItem<VFXItemContent>): void;
119
+ updateParentInfo(parentId: string, parentItem: VFXItem): void;
119
120
  /**
120
121
  * 根据当前场景状态更新内部材质数据
121
122
  * @param scene - 场景管理器
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-plugin-model",
3
- "version": "2.0.0-alpha.12",
3
+ "version": "2.0.0-alpha.13",
4
4
  "description": "Galacean Effects player model plugin",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -19,6 +19,11 @@
19
19
  "import": "./dist/*.mjs",
20
20
  "require": "./dist/*.js",
21
21
  "types": "./dist/*.d.ts"
22
+ },
23
+ "./alipay": {
24
+ "import": "./dist/alipay.mjs",
25
+ "require": "./dist/alipay.js",
26
+ "types": "./dist/index.d.ts"
22
27
  }
23
28
  },
24
29
  "contributors": [
@@ -33,15 +38,15 @@
33
38
  "registry": "https://registry.npmjs.org"
34
39
  },
35
40
  "dependencies": {
36
- "@galacean/effects-helper": "2.0.0-alpha.12"
41
+ "@galacean/effects-helper": "2.0.0-alpha.13"
37
42
  },
38
43
  "devDependencies": {
39
- "@vvfx/resource-detection": "0.6.0-alpha.5",
44
+ "@vvfx/resource-detection": "0.6.0-alpha.8",
40
45
  "@types/hammerjs": "^2.0.45",
41
46
  "fpsmeter": "^0.3.1",
42
47
  "hammerjs": "^2.0.8",
43
- "@galacean/effects": "2.0.0-alpha.12",
44
- "@galacean/effects-plugin-editor-gizmo": "2.0.0-alpha.12"
48
+ "@galacean/effects": "2.0.0-alpha.13",
49
+ "@galacean/effects-plugin-editor-gizmo": "2.0.0-alpha.13"
45
50
  },
46
51
  "scripts": {
47
52
  "dev": "vite",