@galacean/effects-core 0.0.1-alpha.0 → 0.0.1-alpha.2

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT LICENSE
2
+
3
+ Copyright (c) 2019-present Ant Group Co., Ltd. https://www.antgroup.com/
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -32,7 +32,7 @@ mesh 会从 `renderFrame` 中移除。
32
32
  - 插件系统 `pluginSystem.initializeComposition()`
33
33
  - `composition.resetRenderFrame()`:`renderFrame` 的创建和初始化
34
34
  - `composition.reset()`:动画数据解析、Mesh 等渲染实例的状态初始化
35
- - `composition.start()`:合成状态重置
35
+ - `composition.play()`:合成播放
36
36
  3. `update` 方法:用于调用 `renderFrame` 的方法增加/修改/删除 mesh,驱动 `VFXItem` 更新并刷新顶点数据、uniform 变量值等,以下函数会被调用,需要实现:
37
37
  - `updateVideo`:更新视频帧,用于视频播放使用
38
38
  - `getRendererOptions`:返回使用数据创建的空白 `Texture`
@@ -159,4 +159,4 @@ mesh 会根据 `priority` 属性被添加到 `renderPass` 合适位置上。
159
159
 
160
160
  ## API 文档
161
161
 
162
- TODO
162
+ [Galacean Effects Core API 文档](https://galacean.antgroup.com/effects/#/api/modules_galacean_effects_core)
@@ -72,10 +72,6 @@ export interface SceneLoadOptions {
72
72
  * 播放速度,当速度为负数时,合成倒播
73
73
  */
74
74
  speed?: number;
75
- /**
76
- * 播放完成后不销毁 texture 对象,`loadScene` 的结果能再次被播放
77
- */
78
- keepResource?: boolean;
79
75
  }
80
76
  /**
81
77
  * 资源管理器
package/dist/camera.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { vec3 } from '@galacean/effects-specification';
1
2
  import * as spec from '@galacean/effects-specification';
2
3
  import type { mat4 } from './math';
3
4
  /**
@@ -133,6 +134,11 @@ export declare class Camera {
133
134
  * @param model - 模型变换矩阵
134
135
  */
135
136
  getModelViewProjection(out: mat4 | number[], model: mat4): mat4;
137
+ /**
138
+ * 获取归一化坐标和 3D 世界坐标的换算比例
139
+ * @param z - 当前的位置 z
140
+ */
141
+ getInverseVPRatio(z: number): vec3;
136
142
  /**
137
143
  * 设置相机的旋转四元数
138
144
  * @param value - 旋转四元数
@@ -37,6 +37,7 @@ export declare class CompVFXItem extends VFXItem<void> {
37
37
  onItemUpdate(dt: number, lifetime: number): void;
38
38
  onItemRemoved(composition: Composition): void;
39
39
  reset(): void;
40
+ handleVisibleChanged(visible: boolean): void;
40
41
  getUpdateTime(t: number): number;
41
42
  removeItem(item: VFXItem<VFXItemContent>): boolean;
42
43
  /**
@@ -47,6 +48,7 @@ export declare class CompVFXItem extends VFXItem<void> {
47
48
  setItemParent(item: VFXItem<VFXItemContent>, parentItem?: VFXItem<VFXItemContent>): void;
48
49
  /**
49
50
  * 获取指定元素当前时刻真正起作用的父元素, 需要在元素生命周期内获取
51
+ * @internal
50
52
  * @param item - 指定元素
51
53
  * @return 当父元素生命周期结束时,返回空
52
54
  */
@@ -33,10 +33,8 @@ interface CompositionHitTestOptions {
33
33
  skip?: (item: VFXItem<VFXItemContent>) => boolean;
34
34
  }
35
35
  export interface CompositionProps {
36
- keepResource?: boolean;
37
36
  reusable?: boolean;
38
37
  baseRenderOrder?: number;
39
- multipleCompositions?: boolean;
40
38
  renderer: Renderer;
41
39
  handlePlayerPause?: (item: VFXItem<any>) => void;
42
40
  handleMessageItem?: (item: MessageItem) => void;
@@ -44,6 +42,7 @@ export interface CompositionProps {
44
42
  event?: EventSystem;
45
43
  width: number;
46
44
  height: number;
45
+ speed?: number;
47
46
  }
48
47
  /**
49
48
  * 合成抽象类:核心对象,通常一个场景只包含一个合成,可能会有多个合成。
@@ -73,9 +72,9 @@ export declare class Composition implements Disposable, LostHandler {
73
72
  /**
74
73
  * 所有合成 Item 的根变换
75
74
  */
76
- rootTransform: Transform;
75
+ transform: Transform;
77
76
  /**
78
- * 播放完成后是否需要再使用,是的话生命周期结束后不会 dispose
77
+ * 播放完成后是否需要再使用,是的话生命周期结束后不会自动 dispose
79
78
  */
80
79
  reusable: boolean;
81
80
  /**
@@ -182,6 +181,10 @@ export declare class Composition implements Disposable, LostHandler {
182
181
  * 获取合成当前时间
183
182
  */
184
183
  get time(): number;
184
+ /**
185
+ * 获取合成的时长
186
+ */
187
+ getDuration(): number;
185
188
  /**
186
189
  * 获取销毁状态
187
190
  */
@@ -200,6 +203,16 @@ export declare class Composition implements Disposable, LostHandler {
200
203
  * @returns
201
204
  */
202
205
  getIndex(): number;
206
+ /**
207
+ * 设置合成的动画速度
208
+ * @param speed - 速度
209
+ */
210
+ setSpeed(speed: number): void;
211
+ /**
212
+ * 获取合成的动画速度
213
+ * @returns
214
+ */
215
+ getSpeed(): number;
203
216
  play(): void;
204
217
  /**
205
218
  * 暂停合成的播放
@@ -210,23 +223,17 @@ export declare class Composition implements Disposable, LostHandler {
210
223
  */
211
224
  resume(): void;
212
225
  gotoAndPlay(time: number): void;
213
- gotoAndPause(time: number): void;
214
- start(): void;
226
+ gotoAndStop(time: number): void;
215
227
  /**
216
228
  *
217
229
  */
218
230
  createRenderFrame(): void;
219
231
  /**
220
232
  * 跳到指定时间点(不做任何播放行为)
221
- *
222
- * @param time - 时间点(秒),可正可负
233
+ * @param time - 指定的时间
223
234
  */
224
235
  setTime(time: number): void;
225
- /**
226
- * 快进/快退指定时间间隔
227
- * @param timeInSeconds - 需要快进/快退的时间长度(秒),可正可负
228
- */
229
- forwardTime(timeInSeconds: number): void;
236
+ private forwardTime;
230
237
  /**
231
238
  * 重置状态函数
232
239
  */
@@ -245,8 +252,9 @@ export declare class Composition implements Disposable, LostHandler {
245
252
  /**
246
253
  * 合成更新,针对所有 item 的更新
247
254
  * @param deltaTime - 更新的时间步长
255
+ * @param skipRender - 是否需要渲染
248
256
  */
249
- update(deltaTime: number): void;
257
+ update(deltaTime: number, skipRender?: boolean): void;
250
258
  /**
251
259
  * 更新视频数据到纹理
252
260
  * @override
@@ -349,6 +357,22 @@ export declare class Composition implements Disposable, LostHandler {
349
357
  * @param dy - y偏移量
350
358
  */
351
359
  setEditorTransform(scale: number, dx: number, dy: number): void;
360
+ /**
361
+ * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
362
+ */
363
+ translateByPixel(x: number, y: number): void;
364
+ /**
365
+ * 设置合成在 3D 坐标轴上相对移动
366
+ */
367
+ translate(x: number, y: number, z: number): void;
368
+ /**
369
+ * 设置合成在 3D 坐标轴上相对旋转(角度)
370
+ */
371
+ rotate(x: number, y: number, z: number): void;
372
+ /**
373
+ * 设置合成在 3D 坐标轴上相对缩放
374
+ */
375
+ scale(x: number, y: number, z: number): void;
352
376
  /**
353
377
  * 卸载贴图纹理方法,减少内存
354
378
  */
@@ -359,10 +383,4 @@ export declare class Composition implements Disposable, LostHandler {
359
383
  */
360
384
  reloadTexture(): Promise<void>;
361
385
  }
362
- /**
363
- * 根据 id 查找对应的合成,可能找不到
364
- * @param compositions - 合成列表
365
- * @param id - 目标合成 id
366
- */
367
- export declare function getComposition(compositions: spec.Composition[], id?: string): spec.Composition | undefined;
368
386
  export {};
package/dist/config.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export declare const RUNTIME_ENV = "runtime_env";
2
+ export declare const LOG_TYPE = "galacean-effects";
2
3
  export declare const RENDER_PREFER_LOOKUP_TEXTURE = "lookup_texture";
3
4
  export declare const TEMPLATE_USE_OFFSCREEN_CANVAS = "offscreen_canvas";
4
5
  export declare const POST_PROCESS_SETTINGS = "post_process_settings";