@galacean/effects-plugin-model 2.0.3 → 2.0.5

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 +1,294 @@
1
+ import type { Engine, HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, Renderer, VFXItem } from '@galacean/effects';
2
+ import { Behaviour, RendererComponent, AnimationClip } from '@galacean/effects';
3
+ import type { ModelCameraComponentData, ModelItemBounding, ModelLightComponentData, ModelMeshComponentData, ModelSkyboxComponentData, AnimationComponentData } from '../index';
4
+ import type { PSceneManager } from '../runtime';
5
+ import { PCamera, PLight, PMesh, PSkybox } from '../runtime';
6
+ import type { Euler } from '../runtime/math';
7
+ import { Vector3 } from '../runtime/math';
8
+ /**
9
+ * 插件 Mesh 组件类,支持 3D Mesh 渲染能力
10
+ * @since 2.0.0
11
+ */
12
+ export declare class ModelMeshComponent extends RendererComponent {
13
+ /**
14
+ * 内部 Mesh 对象
15
+ */
16
+ content: PMesh;
17
+ /**
18
+ * 参数
19
+ */
20
+ data?: ModelMeshComponentData;
21
+ /**
22
+ * 包围盒
23
+ */
24
+ bounding?: ModelItemBounding;
25
+ /**
26
+ * 场景管理器
27
+ */
28
+ sceneManager?: PSceneManager;
29
+ /**
30
+ * morph 动画权重
31
+ */
32
+ morphWeights: number[];
33
+ /**
34
+ * 构造函数,只保存传入参数,不在这里创建内部对象
35
+ * @param engine - 引擎
36
+ * @param data - Mesh 参数
37
+ */
38
+ constructor(engine: Engine, data?: ModelMeshComponentData);
39
+ /**
40
+ * 组件开始,需要创建内部对象,更新父元素信息和添加到场景管理器中
41
+ */
42
+ start(): void;
43
+ /**
44
+ * 组件更新,更新内部对象状态
45
+ * @param dt - 更新间隔
46
+ */
47
+ update(dt: number): void;
48
+ /**
49
+ * 组件晚更新,晚更新内部对象状态
50
+ * @param dt - 更新间隔
51
+ */
52
+ lateUpdate(dt: number): void;
53
+ /**
54
+ * 组件渲染,需要检查可见性
55
+ * @param renderer - 渲染器
56
+ * @returns
57
+ */
58
+ render(renderer: Renderer): void;
59
+ /**
60
+ * 组件销毁,需要重场景管理器中删除
61
+ */
62
+ onDestroy(): void;
63
+ /**
64
+ * 反序列化,记录传入参数
65
+ * @param data - 组件参数
66
+ */
67
+ fromData(data: ModelMeshComponentData): void;
68
+ /**
69
+ * 创建内部对象
70
+ */
71
+ createContent(): void;
72
+ /**
73
+ * 设置当前 Mesh 的可见性。
74
+ * @param visible - true:可见,false:不可见
75
+ */
76
+ setVisible(visible: boolean): void;
77
+ /**
78
+ * 获取当前 Mesh 的可见性。
79
+ */
80
+ getVisible(): boolean;
81
+ /**
82
+ * 获取点击测试参数,根据元素包围盒进行相交测试,Mesh 对象会进行更加精确的点击测试
83
+ * @param force - 是否强制进行点击测试
84
+ * @returns 点击测试参数
85
+ */
86
+ getHitTestParams: (force?: boolean) => HitTestBoxParams | HitTestSphereParams | HitTestCustomParams | undefined;
87
+ /**
88
+ * 计算元素包围盒,只针对 Mesh 对象
89
+ * @returns 包围盒
90
+ */
91
+ computeBoundingBox(): ModelItemBounding | undefined;
92
+ }
93
+ /**
94
+ * 插件天空盒组件类,支持 3D 天空盒渲染能力
95
+ * @since 2.0.0
96
+ */
97
+ export declare class ModelSkyboxComponent extends RendererComponent {
98
+ /**
99
+ * 内部天空盒对象
100
+ */
101
+ content: PSkybox;
102
+ /**
103
+ * 天空盒参数
104
+ */
105
+ data?: ModelSkyboxComponentData;
106
+ /**
107
+ * 场景管理器
108
+ */
109
+ sceneManager?: PSceneManager;
110
+ /**
111
+ * 构造函数,只保存传入参数,不在这里创建内部对象
112
+ * @param engine - 引擎
113
+ * @param data - Mesh 参数
114
+ */
115
+ constructor(engine: Engine, data?: ModelSkyboxComponentData);
116
+ /**
117
+ * 组件开始,需要创建内部对象和添加到场景管理器中
118
+ */
119
+ start(): void;
120
+ /**
121
+ * 组件渲染,需要检查可见性
122
+ * @param renderer - 渲染器
123
+ * @returns
124
+ */
125
+ render(renderer: Renderer): void;
126
+ /**
127
+ * 组件销毁,需要重场景管理器中删除
128
+ */
129
+ onDestroy(): void;
130
+ /**
131
+ * 反序列化,记录传入参数
132
+ * @param data - 组件参数
133
+ */
134
+ fromData(data: ModelSkyboxComponentData): void;
135
+ /**
136
+ * 创建内部对象
137
+ */
138
+ createContent(): void;
139
+ /**
140
+ * 设置当前可见性。
141
+ * @param visible - true:可见,false:不可见
142
+ */
143
+ setVisible(visible: boolean): void;
144
+ /**
145
+ * 获取当前可见性。
146
+ */
147
+ getVisible(): boolean;
148
+ }
149
+ /**
150
+ * 插件灯光组件类,支持 3D 灯光能力
151
+ * @since 2.0.0
152
+ */
153
+ export declare class ModelLightComponent extends Behaviour {
154
+ /**
155
+ * 内部灯光对象
156
+ */
157
+ content: PLight;
158
+ /**
159
+ * 参数
160
+ */
161
+ data?: ModelLightComponentData;
162
+ /**
163
+ * 构造函数,只保存传入参数,不在这里创建内部对象
164
+ * @param engine - 引擎
165
+ * @param data - Mesh 参数
166
+ */
167
+ constructor(engine: Engine, data?: ModelLightComponentData);
168
+ /**
169
+ * 组件开始,需要创建内部对象和添加到场景管理器中
170
+ */
171
+ start(): void;
172
+ /**
173
+ * 组件更新,更新内部对象状态
174
+ * @param dt - 更新间隔
175
+ */
176
+ update(dt: number): void;
177
+ /**
178
+ * 组件销毁
179
+ */
180
+ onDestroy(): void;
181
+ /**
182
+ * 反序列化,记录传入参数
183
+ * @param data - 组件参数
184
+ */
185
+ fromData(data: ModelLightComponentData): void;
186
+ /**
187
+ * 创建内部对象
188
+ */
189
+ createContent(): void;
190
+ /**
191
+ * 设置当前可见性。
192
+ * @param visible - true:可见,false:不可见
193
+ */
194
+ setVisible(visible: boolean): void;
195
+ /**
196
+ * 获取当前 Mesh 的可见性。
197
+ */
198
+ getVisible(): boolean;
199
+ }
200
+ /**
201
+ * 插件相机组件类,支持 3D 相机能力
202
+ * @since 2.0.0
203
+ */
204
+ export declare class ModelCameraComponent extends Behaviour {
205
+ /**
206
+ * 内部相机对象
207
+ */
208
+ content: PCamera;
209
+ /**
210
+ * 参数
211
+ */
212
+ data?: ModelCameraComponentData;
213
+ /**
214
+ * 构造函数,只保存传入参数,不在这里创建内部对象
215
+ * @param engine - 引擎
216
+ * @param data - Mesh 参数
217
+ */
218
+ constructor(engine: Engine, data?: ModelCameraComponentData);
219
+ /**
220
+ * 组件开始,需要创建内部对象和添加到场景管理器中
221
+ */
222
+ start(): void;
223
+ /**
224
+ * 组件更新,更新内部对象状态
225
+ * @param dt - 更新间隔
226
+ */
227
+ update(dt: number): void;
228
+ /**
229
+ * 组件销毁
230
+ */
231
+ onDestroy(): void;
232
+ /**
233
+ * 反序列化,记录传入参数
234
+ * @param data - 组件参数
235
+ */
236
+ fromData(data: ModelCameraComponentData): void;
237
+ /**
238
+ * 创建内部对象
239
+ */
240
+ createContent(): void;
241
+ /**
242
+ * 更新合成主相机,更加当前相机元素状态
243
+ */
244
+ updateMainCamera(): void;
245
+ /**
246
+ * 设置变换
247
+ * @param position - 位置
248
+ * @param rotation - 旋转
249
+ */
250
+ setTransform(position?: Vector3, rotation?: Euler): void;
251
+ }
252
+ /**
253
+ * 插件动画组件类,支持 3D 动画能力
254
+ * @since 2.0.0
255
+ */
256
+ export declare class AnimationComponent extends Behaviour {
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
+ }
1
294
  export {};
@@ -1,6 +1,6 @@
1
- import type { VFXItem } from '@galacean/effects';
2
- import { Transform } from '@galacean/effects';
3
- import type { ModelTreeOptions } from '../index';
1
+ import type { Engine, VFXItem } from '@galacean/effects';
2
+ import { Behaviour, Transform } from '@galacean/effects';
3
+ import type { ModelTreeContent, ModelTreeOptions } from '../index';
4
4
  import { PAnimationManager } from '../runtime';
5
5
  /**
6
6
  * 场景树节点描述
@@ -82,3 +82,51 @@ export declare class ModelTreeItem {
82
82
  dispose(): void;
83
83
  private build;
84
84
  }
85
+ /**
86
+ * 插件场景树组件类,实现 3D 场景树功能
87
+ * @since 2.0.0
88
+ */
89
+ export declare class ModelTreeComponent extends Behaviour {
90
+ /**
91
+ * 内部节点树元素
92
+ */
93
+ content: ModelTreeItem;
94
+ /**
95
+ * 参数
96
+ */
97
+ options?: ModelTreeContent;
98
+ /**
99
+ * 构造函数,创建节点树元素
100
+ * @param engine
101
+ * @param options
102
+ */
103
+ constructor(engine: Engine, options?: ModelTreeContent);
104
+ /**
105
+ * 反序列化,保存入参和创建节点树元素
106
+ * @param options
107
+ */
108
+ fromData(options: ModelTreeContent): void;
109
+ /**
110
+ * 组件开始,查询合成中场景管理器并设置到动画管理器中
111
+ */
112
+ start(): void;
113
+ /**
114
+ * 组件更新,内部对象更新
115
+ * @param dt
116
+ */
117
+ update(dt: number): void;
118
+ /**
119
+ * 组件销毁,内部对象销毁
120
+ */
121
+ onDestroy(): void;
122
+ /**
123
+ * 创建内部场景树元素
124
+ */
125
+ createContent(): void;
126
+ /**
127
+ * 获取元素的变换
128
+ * @param itemId - 元素索引
129
+ * @returns
130
+ */
131
+ getNodeTransform(itemId: string): Transform;
132
+ }
package/dist/weapp.js CHANGED
@@ -13794,7 +13794,7 @@ var GLTFHelper = /*#__PURE__*/ function() {
13794
13794
 
13795
13795
  EFFECTS.registerPlugin("tree", ModelTreePlugin, EFFECTS.VFXItem, true);
13796
13796
  EFFECTS.registerPlugin("model", ModelPlugin, EFFECTS.VFXItem);
13797
- var version = "2.0.3";
13797
+ var version = "2.0.5";
13798
13798
  EFFECTS.logger.info("Plugin model version: " + version + ".");
13799
13799
  if (version !== EFFECTS__namespace.version) {
13800
13800
  console.error("注意:请统一 Model 插件与 Player 版本,不统一的版本混用会有不可预知的后果!", "\nAttention: Please ensure the Model plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");