@galacean/effects-core 2.8.0-alpha.3 → 2.8.0-alpha.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,5 +1,5 @@
1
1
  import type { Composition } from './composition';
2
- import type { AbstractPlugin, PluginConstructor } from './plugins';
2
+ import type { Plugin, PluginConstructor } from './plugins';
3
3
  import type { Scene, SceneLoadOptions } from './scene';
4
4
  import type { Engine } from './engine';
5
5
  export declare const pluginLoaderMap: Record<string, PluginConstructor>;
@@ -16,10 +16,10 @@ export declare function registerPlugin(name: string, pluginClass: PluginConstruc
16
16
  */
17
17
  export declare function unregisterPlugin(name: string): void;
18
18
  export declare class PluginSystem {
19
- static getPlugins(): AbstractPlugin[];
19
+ static getPlugins(): Plugin[];
20
20
  static initializeComposition(composition: Composition, scene: Scene): void;
21
21
  static destroyComposition(comp: Composition): void;
22
- static processAssets(scene: Scene, options?: SceneLoadOptions): Promise<void[]>;
23
- static loadResources(scene: Scene, options: SceneLoadOptions, engine: Engine): void;
22
+ static onAssetsLoadStart(scene: Scene, options?: SceneLoadOptions): Promise<void[]>;
23
+ static onAssetsLoadFinish(scene: Scene, options: SceneLoadOptions, engine: Engine): void;
24
24
  }
25
25
  export declare function getPluginUsageInfo(name: string): string;
@@ -1,3 +1,3 @@
1
- import { AbstractPlugin } from '../plugin';
2
- export declare class CalculateLoader extends AbstractPlugin {
1
+ import { Plugin } from '../plugin';
2
+ export declare class CalculateLoader extends Plugin {
3
3
  }
@@ -1,3 +1,3 @@
1
- import { AbstractPlugin } from '../plugin';
2
- export declare class CameraVFXItemLoader extends AbstractPlugin {
1
+ import { Plugin } from '../plugin';
2
+ export declare class CameraVFXItemLoader extends Plugin {
3
3
  }
@@ -1,3 +1,3 @@
1
- import { AbstractPlugin } from '../plugin';
2
- export declare class InteractLoader extends AbstractPlugin {
1
+ import { Plugin } from '../plugin';
2
+ export declare class InteractLoader extends Plugin {
3
3
  }
@@ -1,5 +1,5 @@
1
1
  import type { Engine } from '../../engine';
2
- import { AbstractPlugin } from '../plugin';
3
- export declare class ParticleLoader extends AbstractPlugin {
2
+ import { Plugin } from '../plugin';
3
+ export declare class ParticleLoader extends Plugin {
4
4
  engine: Engine;
5
5
  }
@@ -183,7 +183,8 @@ export declare class ParticleSystem extends Component implements Maskable {
183
183
  reset(): void;
184
184
  onStart(): void;
185
185
  onUpdate(dt: number): void;
186
- update(delta: number): void;
186
+ simulate(time: number): void;
187
+ private update;
187
188
  drawStencilMask(renderer: Renderer): void;
188
189
  onDestroy(): void;
189
190
  getParticleBoxes(): {
@@ -2,35 +2,40 @@ import type { Scene, SceneLoadOptions } from '../scene';
2
2
  import type { Composition } from '../composition';
3
3
  import type { Engine } from '../engine';
4
4
  export interface PluginConstructor {
5
- new (): AbstractPlugin;
5
+ new (): Plugin;
6
6
  [key: string]: any;
7
7
  }
8
8
  /**
9
9
  * 抽象插件类
10
10
  * 注册合成不同生命周期的回调函数
11
11
  */
12
- export declare abstract class AbstractPlugin {
12
+ export declare abstract class Plugin {
13
13
  order: number;
14
14
  name: string;
15
- initialize(): void;
16
15
  /**
17
- * loadScene 函数调用的时候会触发此函数,
18
- * 此阶段可以加载插件所需类型资源,并返回原始资源和加载后的资源。
19
- * @param scene
20
- * @param options
21
- * @returns
16
+ * 场景加载时触发,用于加载插件所需的自定义资源。
17
+ * 此阶段适合发起异步资源请求。
18
+ * @param scene - 场景对象
19
+ * @param options - 场景加载选项
22
20
  */
23
- processAssets(scene: Scene, options?: SceneLoadOptions): Promise<void>;
21
+ onAssetsLoadStart(scene: Scene, options?: SceneLoadOptions): Promise<void>;
24
22
  /**
25
- * loadScene 函数调用的时候会触发此函数,
26
- * 此阶段时,json 中的图片和二进制已经被加载完成,可以对加载好的资源做进一步处理,
27
- * 如果 promise reject, loadScene 函数同样会被 reject,表示场景加载失败。
28
- * 请记住,整个 load 阶段都不要创建 GL 相关的对象,只创建 JS 对象
29
- * 此阶段晚于 processAssets
30
- * @param {Scene} scene
31
- * @param {SceneLoadOptions} options
23
+ * 场景资源加载完成后触发。
24
+ * 此时 JSON 中的图片和二进制已加载完成,可对资源做进一步处理。
25
+ * @param scene - 场景对象
26
+ * @param options - 场景加载选项
27
+ * @param engine - 引擎实例
32
28
  */
33
- prepareResource(scene: Scene, options: SceneLoadOptions, engine: Engine): void;
34
- onCompositionConstructed(composition: Composition, scene: Scene): void;
35
- onCompositionDestroyed(composition: Composition): void;
29
+ onAssetsLoadFinish(scene: Scene, options: SceneLoadOptions, engine: Engine): void;
30
+ /**
31
+ * 合成创建完成后触发。
32
+ * @param composition - 合成对象
33
+ * @param scene - 场景对象
34
+ */
35
+ onCompositionCreated(composition: Composition, scene: Scene): void;
36
+ /**
37
+ * 合成销毁时触发。
38
+ * @param composition - 合成对象
39
+ */
40
+ onCompositionDestroy(composition: Composition): void;
36
41
  }
@@ -41,7 +41,6 @@ export declare class ComponentTimePlayable extends Playable {
41
41
  export declare class SpriteComponent extends MaskableGraphic {
42
42
  time: number;
43
43
  duration: number;
44
- loop: boolean;
45
44
  protected textureSheetAnimation?: spec.TextureSheetAnimation;
46
45
  constructor(engine: Engine, props?: spec.SpriteComponentData);
47
46
  onUpdate(dt: number): void;
@@ -1,4 +1,4 @@
1
- import { AbstractPlugin } from '../plugin';
2
- export declare class SpriteLoader extends AbstractPlugin {
1
+ import { Plugin } from '../plugin';
2
+ export declare class SpriteLoader extends Plugin {
3
3
  name: string;
4
4
  }
@@ -26,6 +26,14 @@ export declare class TextComponent extends MaskableGraphic implements ITextCompo
26
26
  * 每一行文本的最大宽度
27
27
  */
28
28
  protected maxLineWidth: number;
29
+ /**
30
+ * 初始文本宽度,用于计算缩放比例
31
+ */
32
+ private baseTextWidth;
33
+ /**
34
+ * 初始 `transform.size.x`,用于按比例更新显示宽度
35
+ */
36
+ private baseScaleX;
29
37
  private getDefaultProps;
30
38
  constructor(engine: Engine);
31
39
  onUpdate(dt: number): void;
@@ -36,7 +44,7 @@ export declare class TextComponent extends MaskableGraphic implements ITextCompo
36
44
  /**
37
45
  * 根据配置更新文本样式和布局
38
46
  */
39
- protected updateWithOptions(options: spec.TextContentOptions): void;
47
+ updateWithOptions(options: spec.TextContentOptions): void;
40
48
  getLineCount(text: string): number;
41
49
  /**
42
50
  * 设置行高
@@ -88,6 +96,13 @@ export declare class TextComponent extends MaskableGraphic implements ITextCompo
88
96
  protected updateTexture(flipY?: boolean): void;
89
97
  renderText(options: spec.TextContentOptions): void;
90
98
  setAutoWidth(value: boolean): void;
99
+ /**
100
+ * 设置文本框宽度
101
+ * 手动设置宽度时会自动关闭 `autoWidth`
102
+ * 同时会按比例更新 `transform.size.x`,让 UI 框宽度也跟着变化
103
+ * @param value - 文本框宽度
104
+ */
105
+ setTextWidth(value: number): void;
91
106
  setFontSize(value: number): void;
92
107
  setOutlineWidth(value: number): void;
93
108
  setShadowBlur(value: number): void;
@@ -1,3 +1,3 @@
1
- import { AbstractPlugin } from '../index';
2
- export declare class TextLoader extends AbstractPlugin {
1
+ import { Plugin } from '../index';
2
+ export declare class TextLoader extends Plugin {
3
3
  }
package/dist/scene.d.ts CHANGED
@@ -72,6 +72,11 @@ export interface SceneLoadOptions {
72
72
  * @default undefined
73
73
  */
74
74
  useCompressedTexture?: boolean;
75
+ /**
76
+ * 是否使用 Hevc 视频
77
+ * @default undefined
78
+ */
79
+ useHevcVideo?: boolean;
75
80
  /**
76
81
  * 渲染分级。
77
82
  * 分级之后,只会加载当前渲染等级的资源。
@@ -0,0 +1,13 @@
1
+ import * as spec from '@galacean/effects-specification';
2
+ /**
3
+ * Check if the browser can play the given HEVC codec.
4
+ * @param codec - The HEVC codec to check.
5
+ * @returns True if the browser can probably or maybe play the codec, false otherwise.
6
+ */
7
+ export declare function canPlayHevcCodec(codec: spec.HevcVideoCodec): boolean;
8
+ /**
9
+ * Parse the given codec string into a HEVC video codec enum value.
10
+ * @param codec - The codec string to parse.
11
+ * @returns The corresponding HEVC video codec enum value, or undefined if the codec is invalid.
12
+ */
13
+ export declare function parseCodec(codec: string): spec.HevcVideoCodec | undefined;
@@ -5,6 +5,7 @@ export * from './image-data';
5
5
  export * from './sortable';
6
6
  export * from './asserts';
7
7
  export * from './text';
8
+ export * from './hevc-video';
8
9
  export * from './promise-util';
9
10
  export * from './logger';
10
11
  export type Immutable<O> = O extends Record<any, any> ? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-core",
3
- "version": "2.8.0-alpha.3",
3
+ "version": "2.8.0-alpha.5",
4
4
  "description": "Galacean Effects runtime core for the web",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -42,7 +42,7 @@
42
42
  "registry": "https://registry.npmjs.org"
43
43
  },
44
44
  "dependencies": {
45
- "@galacean/effects-specification": "2.7.0-alpha.0",
45
+ "@galacean/effects-specification": "2.7.0",
46
46
  "@galacean/effects-math": "1.1.0",
47
47
  "flatbuffers": "24.3.25",
48
48
  "uuid": "9.0.1",