@galacean/effects-core 2.0.0-alpha.11 → 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.
Files changed (61) hide show
  1. package/dist/asset-loader.d.ts +0 -6
  2. package/dist/binary-asset.d.ts +6 -0
  3. package/dist/comp-vfx-item.d.ts +23 -6
  4. package/dist/components/component.d.ts +2 -2
  5. package/dist/composition-source-manager.d.ts +3 -0
  6. package/dist/composition.d.ts +25 -20
  7. package/dist/decorators.d.ts +1 -1
  8. package/dist/engine.d.ts +7 -4
  9. package/dist/fallback/migration.d.ts +1 -1
  10. package/dist/fallback/utils.d.ts +0 -11
  11. package/dist/gl/create-gl-context.d.ts +2 -1
  12. package/dist/gl/index.d.ts +3 -0
  13. package/dist/index.d.ts +5 -4
  14. package/dist/index.js +14219 -13190
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +11976 -10966
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/math/bezier.d.ts +15 -0
  19. package/dist/math/translate.d.ts +3 -2
  20. package/dist/math/value-getter.d.ts +25 -1
  21. package/dist/plugin-system.d.ts +1 -1
  22. package/dist/plugins/cal/animation-mixer-playable.d.ts +1 -1
  23. package/dist/plugins/cal/animation-playable-output.d.ts +1 -1
  24. package/dist/plugins/cal/animation-playable.d.ts +2 -1
  25. package/dist/plugins/cal/calculate-item.d.ts +7 -26
  26. package/dist/plugins/cal/calculate-vfx-item.d.ts +53 -13
  27. package/dist/plugins/cal/playable-graph.d.ts +72 -21
  28. package/dist/plugins/cal/timeline-asset.d.ts +28 -0
  29. package/dist/plugins/camera/camera-controller-node.d.ts +0 -11
  30. package/dist/plugins/index.d.ts +5 -1
  31. package/dist/plugins/interact/click-handler.d.ts +2 -2
  32. package/dist/plugins/interact/event-system.d.ts +0 -2
  33. package/dist/plugins/particle/particle-system-renderer.d.ts +1 -1
  34. package/dist/plugins/particle/particle-system.d.ts +1 -1
  35. package/dist/plugins/particle/particle-vfx-item.d.ts +7 -3
  36. package/dist/plugins/plugin.d.ts +6 -6
  37. package/dist/plugins/sprite/sprite-item.d.ts +14 -9
  38. package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +8 -0
  39. package/dist/plugins/timeline/track.d.ts +73 -0
  40. package/dist/plugins/timeline/tracks/activation-track.d.ts +5 -0
  41. package/dist/plugins/timeline/tracks/sprite-color-track.d.ts +3 -0
  42. package/dist/plugins/timeline/tracks/transform-track.d.ts +3 -0
  43. package/dist/render/{frame-buffer.d.ts → framebuffer.d.ts} +7 -7
  44. package/dist/render/geometry.d.ts +14 -1
  45. package/dist/render/gpu-capability.d.ts +6 -6
  46. package/dist/render/index.d.ts +2 -2
  47. package/dist/render/render-frame.d.ts +4 -4
  48. package/dist/render/render-pass.d.ts +8 -8
  49. package/dist/render/{render-buffer.d.ts → renderbuffer.d.ts} +4 -4
  50. package/dist/render/renderer.d.ts +7 -6
  51. package/dist/render/semantic-map.d.ts +1 -1
  52. package/dist/texture/texture.d.ts +2 -0
  53. package/dist/texture/types.d.ts +2 -2
  54. package/dist/ticker.d.ts +2 -2
  55. package/dist/utils/device.d.ts +1 -0
  56. package/dist/utils/index.d.ts +1 -1
  57. package/dist/utils/text.d.ts +8 -0
  58. package/dist/vfx-item.d.ts +27 -44
  59. package/package.json +3 -3
  60. package/dist/plugins/cal/track.d.ts +0 -34
  61. package/dist/utils/timeline-component.d.ts +0 -6
@@ -0,0 +1,73 @@
1
+ import { ItemEndBehavior } from '@galacean/effects-specification';
2
+ import type { Engine } from '../../engine';
3
+ import { VFXItem } from '../../vfx-item';
4
+ import type { PlayableGraph } from '../cal/playable-graph';
5
+ import { Playable, PlayableAsset, PlayableOutput } from '../cal/playable-graph';
6
+ /**
7
+ * @since 2.0.0
8
+ * @internal
9
+ */
10
+ export declare class TrackAsset extends PlayableAsset {
11
+ id: string;
12
+ name: string;
13
+ binding: VFXItem;
14
+ trackType: TrackType;
15
+ private clipSeed;
16
+ private clips;
17
+ protected children: TrackAsset[];
18
+ initializeBinding(parentBinding: object): void;
19
+ /**
20
+ * @internal
21
+ */
22
+ initializeBindingRecursive(parentBinding: object): void;
23
+ createOutput(): PlayableOutput;
24
+ createPlayableGraph(graph: PlayableGraph, runtimeClips: RuntimeClip[]): Playable;
25
+ createMixerPlayableGraph(graph: PlayableGraph, runtimeClips: RuntimeClip[]): Playable;
26
+ compileClips(graph: PlayableGraph, timelineClips: TimelineClip[], runtimeClips: RuntimeClip[]): Playable;
27
+ /**
28
+ * 重写该方法以创建自定义混合器
29
+ */
30
+ createTrackMixer(graph: PlayableGraph): Playable;
31
+ createPlayable(graph: PlayableGraph): Playable;
32
+ getChildTracks(): TrackAsset[];
33
+ createClip<T extends PlayableAsset>(classConstructor: new (engine: Engine) => T, name?: string): TimelineClip;
34
+ getClips(): TimelineClip[];
35
+ findClip(name: string): TimelineClip | undefined;
36
+ addClip(clip: TimelineClip): void;
37
+ private createClipPlayable;
38
+ }
39
+ export declare enum TrackType {
40
+ MasterTrack = 0,
41
+ ObjectTrack = 1
42
+ }
43
+ /**
44
+ * @since 2.0.0
45
+ * @internal
46
+ */
47
+ export declare class TimelineClip {
48
+ id: string;
49
+ name: string;
50
+ start: number;
51
+ duration: number;
52
+ asset: PlayableAsset;
53
+ endBehaviour: ItemEndBehavior;
54
+ constructor();
55
+ toLocalTime(time: number): number;
56
+ }
57
+ export declare class RuntimeClip {
58
+ clip: TimelineClip;
59
+ playable: Playable;
60
+ parentMixer: Playable;
61
+ track: TrackAsset;
62
+ constructor(clip: TimelineClip, clipPlayable: Playable, parentMixer: Playable, track: TrackAsset);
63
+ set enable(value: boolean);
64
+ evaluateAt(localTime: number): void;
65
+ private onClipEnd;
66
+ }
67
+ /**
68
+ * @since 2.0.0
69
+ * @internal
70
+ */
71
+ export interface TimelineClipData {
72
+ asset: PlayableAsset;
73
+ }
@@ -0,0 +1,5 @@
1
+ import type { PlayableGraph, Playable } from '../../cal/playable-graph';
2
+ import { TrackAsset } from '../track';
3
+ export declare class ActivationTrack extends TrackAsset {
4
+ createTrackMixer(graph: PlayableGraph): Playable;
5
+ }
@@ -0,0 +1,3 @@
1
+ import { TrackAsset } from '../track';
2
+ export declare class SpriteColorTrack extends TrackAsset {
3
+ }
@@ -0,0 +1,3 @@
1
+ import { TrackAsset } from '../track';
2
+ export declare class TransformTrack extends TrackAsset {
3
+ }
@@ -1,9 +1,9 @@
1
1
  import type { Texture } from '../texture';
2
- import type { RenderBuffer } from './render-buffer';
2
+ import type { Renderbuffer } from './renderbuffer';
3
3
  import type { RenderPassAttachmentStorageType, RenderPassDepthStencilAttachmentOptions } from './render-pass';
4
4
  import type { RenderPassDestroyAttachmentType, RenderPassStoreAction } from './render-pass';
5
5
  import type { Renderer } from './renderer';
6
- export interface FrameBufferProps {
6
+ export interface FramebufferProps {
7
7
  attachments: Texture[];
8
8
  depthStencilAttachment?: RenderPassDepthStencilAttachmentOptions;
9
9
  isCustomViewport?: boolean;
@@ -23,7 +23,7 @@ export declare enum RenderTextureFormat {
23
23
  /**
24
24
  *
25
25
  */
26
- export declare class FrameBuffer {
26
+ export declare class Framebuffer {
27
27
  depthStencilStorageType: RenderPassAttachmentStorageType;
28
28
  name: string;
29
29
  viewportScale: number;
@@ -32,17 +32,17 @@ export declare class FrameBuffer {
32
32
  externalStorage: boolean;
33
33
  storeAction: RenderPassStoreAction;
34
34
  isCustomViewport: boolean;
35
- static create: (props: FrameBufferProps, renderer: Renderer) => FrameBuffer;
35
+ static create: (props: FramebufferProps, renderer: Renderer) => Framebuffer;
36
36
  resize(x: number, y: number, width: number, height: number): void;
37
37
  resetColorTextures(textures: Texture[]): void;
38
38
  unbind(): void;
39
39
  bind(): void;
40
- get stencilStorage(): RenderBuffer | undefined;
41
- get depthStorage(): RenderBuffer | undefined;
40
+ get stencilStorage(): Renderbuffer | undefined;
41
+ get depthStorage(): Renderbuffer | undefined;
42
42
  getDepthTexture(): Texture | undefined;
43
43
  getStencilTexture(): Texture | undefined;
44
44
  getColorTextures(): Texture[];
45
- dispose(opt?: {
45
+ dispose(options?: {
46
46
  depthStencilAttachment?: RenderPassDestroyAttachmentType;
47
47
  }): void;
48
48
  }
@@ -24,6 +24,11 @@ export interface GeometryProps {
24
24
  */
25
25
  maxVertex?: number;
26
26
  }
27
+ export interface SkinProps {
28
+ boneNames?: string[];
29
+ rootBoneName?: string;
30
+ inverseBindMatrices?: number[];
31
+ }
27
32
  /**
28
33
  * Geometry 抽象类
29
34
  */
@@ -32,6 +37,10 @@ export declare abstract class Geometry extends EffectsObject {
32
37
  * Geometry 的名称
33
38
  */
34
39
  name: string;
40
+ /**
41
+ * 子网格数据
42
+ */
43
+ subMeshes: spec.SubMesh[];
35
44
  /**
36
45
  * Geometry 创建函数
37
46
  */
@@ -96,6 +105,10 @@ export declare abstract class Geometry extends EffectsObject {
96
105
  * 获取当前 Geometry 的 drawcount
97
106
  */
98
107
  abstract getDrawCount(): number;
108
+ /**
109
+ * 获取当前 Geometry 关联的蒙皮数据
110
+ */
111
+ abstract getSkinProps(): SkinProps;
99
112
  /**
100
113
  * 初始化 GPU 资源
101
114
  * @override
@@ -106,4 +119,4 @@ export declare abstract class Geometry extends EffectsObject {
106
119
  */
107
120
  flush(): void;
108
121
  }
109
- export declare function generateEmptyTypedArray(type: number): Float32Array | Int32Array | Int16Array;
122
+ export declare function generateEmptyTypedArray(type: number): Float32Array | Int16Array | Int32Array;
@@ -1,5 +1,5 @@
1
+ import type { GLType } from '../gl';
1
2
  import type { Immutable } from '../utils';
2
- export type GLType = 'webgl' | 'webgl2';
3
3
  export interface GPUCapabilityDetail {
4
4
  floatTexture: number;
5
5
  halfFloatTexture: number;
@@ -42,8 +42,8 @@ export declare class GPUCapability {
42
42
  drawBuffers(gl: WebGLRenderingContext | WebGL2RenderingContext, bufferStates: boolean[]): void;
43
43
  setTextureAnisotropic(gl: WebGLRenderingContext | WebGL2RenderingContext, target: GLenum, level: number): void;
44
44
  }
45
- export declare const COMPRESSED_TEXTURE: {
46
- NONE: number;
47
- PVRTC: number;
48
- ASTC: number;
49
- };
45
+ export declare enum COMPRESSED_TEXTURE {
46
+ NONE = 0,
47
+ PVRTC = 1,
48
+ ASTC = 2
49
+ }
@@ -1,13 +1,13 @@
1
1
  export * from './create-copy-shader';
2
2
  export * from './render-frame';
3
- export * from './render-buffer';
3
+ export * from './renderbuffer';
4
4
  export * from './render-pass';
5
5
  export * from './shader';
6
6
  export * from './gpu-capability';
7
7
  export * from './mesh';
8
8
  export * from './types';
9
9
  export * from './geometry';
10
- export * from './frame-buffer';
10
+ export * from './framebuffer';
11
11
  export * from './renderer';
12
12
  export * from './global-volume';
13
13
  export * from './semantic-map';
@@ -69,11 +69,11 @@ export interface RenderPassInfo {
69
69
  */
70
70
  export interface RenderFrameResource {
71
71
  /**
72
- * 纹理对象,用于 FrameBuffer 的颜色 Attachment
72
+ * 纹理对象,用于 Framebuffer 的颜色 Attachment
73
73
  */
74
74
  color_a: Texture;
75
75
  /**
76
- * 纹理对象,用于 FrameBuffer 的颜色 Attachment
76
+ * 纹理对象,用于 Framebuffer 的颜色 Attachment
77
77
  */
78
78
  color_b: Texture;
79
79
  /**
@@ -210,7 +210,7 @@ export declare class RenderFrame implements Disposable {
210
210
  */
211
211
  dispose(options?: RenderFrameDestroyOptions): void;
212
212
  /**
213
- * 重置 RenderPass ColorAttachment,解决 FrameBuffer 即读又写的问题
213
+ * 重置 RenderPass ColorAttachment,解决 Framebuffer 即读又写的问题
214
214
  * @param renderPasses - RenderPass 对象数组
215
215
  * @param startIndex - 开始重置的索引
216
216
  */
@@ -239,7 +239,7 @@ export declare class RenderFrame implements Disposable {
239
239
  createResource(): void;
240
240
  /**
241
241
  * 创建拷贝 RenderPass 用到的 Mesh 对象
242
- * @param semantics - RenderPass 渲染时 FrameBuffer 的颜色和深度纹理、大小和是否混合
242
+ * @param semantics - RenderPass 渲染时 Framebuffer 的颜色和深度纹理、大小和是否混合
243
243
  */
244
244
  createCopyMesh(semantics?: {
245
245
  tex?: string;
@@ -4,14 +4,14 @@ import type { Camera } from '../camera';
4
4
  import type { RendererComponent } from '../components';
5
5
  import type { Engine } from '../engine';
6
6
  import type { MeshDestroyOptions, Renderer } from '../render';
7
- import { FrameBuffer } from '../render';
7
+ import { Framebuffer } from '../render';
8
8
  import type { SemanticGetter } from './semantic-map';
9
9
  import { SemanticMap } from './semantic-map';
10
10
  import type { TextureConfigOptions, TextureLoadAction } from '../texture';
11
11
  import { Texture } from '../texture';
12
12
  import type { Disposable, Sortable } from '../utils';
13
13
  import { DestroyOptions, OrderType } from '../utils';
14
- import type { RenderBuffer } from './render-buffer';
14
+ import type { Renderbuffer } from './renderbuffer';
15
15
  import type { RenderingData } from './render-frame';
16
16
  export declare const RenderPassPriorityPrepare = 0;
17
17
  export declare const RenderPassPriorityNormal = 1000;
@@ -76,9 +76,9 @@ export interface RenderPassColorAttachmentOptions {
76
76
  /**
77
77
  * ColorAttachment 的 Buffer 参数
78
78
  */
79
- buffer?: RenderBuffer;
79
+ buffer?: Renderbuffer;
80
80
  /**
81
- * WebGL2 下 RenderBuffer 超采数目。默认是0,即不启用超采。
81
+ * WebGL2 下 Renderbuffer 超采数目。默认是0,即不启用超采。
82
82
  * @default 0
83
83
  */
84
84
  multiSample?: number;
@@ -102,12 +102,12 @@ export declare class RenderTargetHandle implements Disposable {
102
102
  }
103
103
  export interface RenderPassDepthStencilAttachment {
104
104
  readonly storageType: RenderPassAttachmentStorageType;
105
- readonly storage?: RenderBuffer;
105
+ readonly storage?: Renderbuffer;
106
106
  readonly texture?: Texture;
107
107
  }
108
108
  export interface RenderPassDepthStencilAttachmentOptions {
109
109
  storageType: RenderPassAttachmentStorageType;
110
- storage?: RenderBuffer;
110
+ storage?: Renderbuffer;
111
111
  texture?: Texture;
112
112
  }
113
113
  /**
@@ -209,7 +209,7 @@ export declare class RenderPass implements Disposable, Sortable {
209
209
  * ColorAttachment 数组
210
210
  */
211
211
  attachments: RenderTargetHandle[];
212
- frameBuffer?: FrameBuffer;
212
+ framebuffer: Framebuffer | null;
213
213
  /**
214
214
  * 名称
215
215
  */
@@ -227,7 +227,7 @@ export declare class RenderPass implements Disposable, Sortable {
227
227
  */
228
228
  readonly camera?: Camera;
229
229
  /**
230
- * 深度和蒙版 Attachment 类型,注意区分纹理和 RenderBuffer
230
+ * 深度和蒙版 Attachment 类型,注意区分纹理和 Renderbuffer
231
231
  */
232
232
  readonly depthStencilType: RenderPassAttachmentStorageType;
233
233
  /**
@@ -1,19 +1,19 @@
1
1
  import type { Disposable } from '../utils';
2
2
  import type { RenderPassAttachmentStorageType } from './render-pass';
3
- export interface RenderBufferProps {
3
+ export interface RenderbufferProps {
4
4
  storageType: RenderPassAttachmentStorageType;
5
5
  format: GLenum;
6
6
  attachment: GLenum;
7
7
  }
8
- export declare abstract class RenderBuffer implements Disposable {
8
+ export declare abstract class Renderbuffer implements Disposable {
9
9
  readonly size: [x: number, y: number];
10
10
  readonly multiSample = 1;
11
11
  readonly storageType: RenderPassAttachmentStorageType;
12
12
  readonly format: GLenum;
13
13
  readonly attachment: GLenum;
14
14
  protected destroyed: boolean;
15
- static create: (props: RenderBufferProps) => RenderBuffer;
16
- constructor(props: RenderBufferProps);
15
+ static create: (props: RenderbufferProps) => Renderbuffer;
16
+ constructor(props: RenderbufferProps);
17
17
  get isDestroyed(): boolean;
18
18
  abstract setSize(width: number, height: number): void;
19
19
  abstract dispose(): void;
@@ -3,13 +3,14 @@ import type { RendererComponent } from '../components/renderer-component';
3
3
  import type { Engine } from '../engine';
4
4
  import type { Material } from '../material';
5
5
  import type { LostHandler, RestoreHandler } from '../utils';
6
- import type { FilterMode, FrameBuffer, RenderTextureFormat } from './frame-buffer';
6
+ import type { FilterMode, Framebuffer, RenderTextureFormat } from './framebuffer';
7
7
  import type { Geometry } from './geometry';
8
8
  import type { RenderFrame, RenderingData } from './render-frame';
9
9
  import type { RenderPassClearAction, RenderPassStoreAction } from './render-pass';
10
10
  import type { ShaderLibrary } from './shader';
11
+ import type { GLType } from '../gl';
11
12
  export declare class Renderer implements LostHandler, RestoreHandler {
12
- static create: (canvas: HTMLCanvasElement | OffscreenCanvas, framework: 'webgl' | 'webgl2', renderOptions?: WebGLContextAttributes) => Renderer;
13
+ static create: (canvas: HTMLCanvasElement | OffscreenCanvas, framework: GLType, renderOptions?: WebGLContextAttributes) => Renderer;
13
14
  engine: Engine;
14
15
  env: string;
15
16
  /**
@@ -20,8 +21,8 @@ export declare class Renderer implements LostHandler, RestoreHandler {
20
21
  setGlobalFloat(name: string, value: number): void;
21
22
  setGlobalInt(name: string, value: number): void;
22
23
  setGlobalMatrix(name: string, value: Matrix4): void;
23
- getFrameBuffer(): FrameBuffer | null;
24
- setFrameBuffer(frameBuffer: FrameBuffer | null): void;
24
+ getFramebuffer(): Framebuffer | null;
25
+ setFramebuffer(framebuffer: Framebuffer | null): void;
25
26
  setViewport(x: number, y: number, width: number, height: number): void;
26
27
  resize(canvasWidth: number, canvasHeight: number): void;
27
28
  clear(action: RenderPassClearAction | RenderPassStoreAction): void;
@@ -56,7 +57,7 @@ export declare class Renderer implements LostHandler, RestoreHandler {
56
57
  getShaderLibrary(): ShaderLibrary | undefined;
57
58
  renderRenderFrame(renderFrame: RenderFrame): void;
58
59
  renderMeshes(meshes: RendererComponent[]): void;
59
- drawGeometry(geometry: Geometry, material: Material): void;
60
- getTemporaryRT(name: string, width: number, height: number, depthBuffer: number, filter: FilterMode, format: RenderTextureFormat): FrameBuffer | null;
60
+ drawGeometry(geometry: Geometry, material: Material, subMeshIndex?: number): void;
61
+ getTemporaryRT(name: string, width: number, height: number, depthBuffer: number, filter: FilterMode, format: RenderTextureFormat): Framebuffer | null;
61
62
  dispose(haltGL?: boolean): void;
62
63
  }
@@ -8,7 +8,7 @@ export declare class SemanticMap implements Disposable {
8
8
  constructor(semantics?: Record<string, SemanticGetter>);
9
9
  toObject(): Record<string, SemanticGetter>;
10
10
  setSemantic(name: string, value?: SemanticGetter): void;
11
- getSemanticValue(name: string, state: RenderingData): number | Float32Array | Int32Array | Float64Array | Uint8Array | Uint32Array | Uint16Array | Int8Array | Int16Array | number[] | number[][] | import("@galacean/effects-core").Texture | import("@galacean/effects-math/es/core").Vector2 | import("@galacean/effects-math/es/core").Vector3 | import("@galacean/effects-math/es/core").Vector4 | import("@galacean/effects-math/es/core").Matrix3 | import("@galacean/effects-math/es/core").Matrix4 | import("@galacean/effects-core").Texture[] | import("packages/effects-core/src/material/types").UniformStruct | import("packages/effects-core/src/material/types").UniformStruct[] | SemanticFunc | undefined;
11
+ getSemanticValue(name: string, state: RenderingData): number | Float32Array | Float64Array | Uint8Array | Uint32Array | Uint16Array | Int8Array | Int16Array | Int32Array | number[] | number[][] | import("@galacean/effects-core").Texture | import("@galacean/effects-math/es/core").Vector2 | import("@galacean/effects-math/es/core").Vector3 | import("@galacean/effects-math/es/core").Vector4 | import("@galacean/effects-math/es/core").Matrix3 | import("@galacean/effects-math/es/core").Matrix4 | import("@galacean/effects-core").Texture[] | import("packages/effects-core/src/material/types").UniformStruct | import("packages/effects-core/src/material/types").UniformStruct[] | SemanticFunc | undefined;
12
12
  hasSemanticValue(name: string): boolean;
13
13
  dispose(): void;
14
14
  }
@@ -82,3 +82,5 @@ export declare abstract class Texture extends EffectsObject {
82
82
  protected assembleOptions(options: TextureSourceOptions): TextureSourceOptions;
83
83
  }
84
84
  export declare function generateHalfFloatTexture(engine: Engine, data: Uint16Array, width: number, height: number): Texture;
85
+ export declare function generateWhiteTexture(engine: Engine): Texture;
86
+ export declare function generateTransparentTexture(engine: Engine): Texture;
@@ -148,7 +148,7 @@ export interface Texture2DSourceOptionsCompressed extends TextureOptionsBase {
148
148
  mipmaps: TextureDataType[];
149
149
  target?: WebGLRenderingContext['TEXTURE_2D'] | WebGLRenderingContext['TEXTURE_CUBE_MAP'];
150
150
  }
151
- export interface Texture2DSourceOptionsFrameBuffer extends TextureOptionsBase {
151
+ export interface Texture2DSourceOptionsFramebuffer extends TextureOptionsBase {
152
152
  sourceType: TextureSourceType.framebuffer;
153
153
  data?: {
154
154
  width: number;
@@ -160,6 +160,6 @@ export interface Texture2DSourceOptionsNone extends TextureOptionsBase {
160
160
  sourceType?: TextureSourceType.none;
161
161
  target?: GLenum;
162
162
  }
163
- export type Texture2DSourceOptions = Texture2DSourceOptionsImage | Texture2DSourceOptionsData | Texture2DSourceOptionsVideo | Texture2DSourceOptionsImageMipmaps | Texture2DSourceOptionsCompressed | Texture2DSourceOptionsFrameBuffer | Texture2DSourceOptionsNone;
163
+ export type Texture2DSourceOptions = Texture2DSourceOptionsImage | Texture2DSourceOptionsData | Texture2DSourceOptionsVideo | Texture2DSourceOptionsImageMipmaps | Texture2DSourceOptionsCompressed | Texture2DSourceOptionsFramebuffer | Texture2DSourceOptionsNone;
164
164
  export type TextureSourceOptions = Texture2DSourceOptions | TextureCubeSourceOptions;
165
165
  export {};
package/dist/ticker.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare class Ticker {
9
9
  private interval;
10
10
  private intervalId;
11
11
  private resetTickers;
12
- private _deltaTime;
12
+ private dt;
13
13
  constructor(fps?: number);
14
14
  /**
15
15
  * 获取定时器当前帧更新的时间
@@ -22,7 +22,7 @@ export declare class Ticker {
22
22
  setFPS(fps: number): void;
23
23
  /**
24
24
  * 获取定时器暂停标志位
25
- * @returns 暂停标志位
25
+ * @returns
26
26
  */
27
27
  getPaused(): boolean;
28
28
  /**
@@ -2,3 +2,4 @@ export declare function getPixelRatio(): number;
2
2
  export declare function isIOS(): boolean;
3
3
  export declare function isAndroid(): boolean;
4
4
  export declare function isSimulatorCellPhone(): boolean;
5
+ export declare function isAlipayMiniApp(): boolean;
@@ -4,7 +4,7 @@ export * from './device';
4
4
  export * from './image-data';
5
5
  export * from './sortable';
6
6
  export * from './asserts';
7
- export * from './timeline-component';
7
+ export * from './text';
8
8
  export * from './logger';
9
9
  export type Immutable<O> = O extends Record<any, any> ? {
10
10
  readonly [key in keyof O]: Immutable<O[key]>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 判断是否为可解析的字体
3
+ * - 首字母不能为数字或 `.`
4
+ * - 不能包含特殊字符,`_-` 是被允许的
5
+ * @param fontFamily - 字体名称
6
+ * @returns
7
+ */
8
+ export declare function isValidFontFamily(fontFamily: string): boolean;
@@ -8,11 +8,10 @@ import type { Composition } from './composition';
8
8
  import { EffectsObject } from './effects-object';
9
9
  import type { Engine } from './engine';
10
10
  import type { BoundingBoxData, CameraController, HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, HitTestTriangleParams, InteractComponent, ParticleSystem, SpriteComponent } from './plugins';
11
- import { TimelineComponent } from './plugins';
12
11
  import { Transform } from './transform';
13
12
  import { type Disposable } from './utils';
14
- export type VFXItemContent = ParticleSystem | SpriteComponent | TimelineComponent | CameraController | InteractComponent | void | {};
15
- export type VFXItemConstructor = new (enigne: Engine, props: VFXItemProps, composition: Composition) => VFXItem<VFXItemContent>;
13
+ export type VFXItemContent = ParticleSystem | SpriteComponent | CameraController | InteractComponent | void | {};
14
+ export type VFXItemConstructor = new (engine: Engine, props: VFXItemProps, composition: Composition) => VFXItem;
16
15
  export type VFXItemProps = spec.Item & {
17
16
  items: VFXItemProps[];
18
17
  startTime: number;
@@ -23,7 +22,7 @@ export type VFXItemProps = spec.Item & {
23
22
  /**
24
23
  * 所有元素的继承的抽象类
25
24
  */
26
- export declare class VFXItem<T extends VFXItemContent> extends EffectsObject implements Disposable {
25
+ export declare class VFXItem extends EffectsObject implements Disposable {
27
26
  /**
28
27
  * 元素绑定的父元素,
29
28
  * 1. 当元素没有绑定任何父元素时,parent为空,transform.parentTransform 为 composition.transform
@@ -31,8 +30,8 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
31
30
  * 3. 当元素绑定 TreeItem 的node时,parent为treeItem, transform.parentTransform 为 tree.nodes[i].transform(绑定的node节点上的transform)
32
31
  * 4. 当元素绑定 TreeItem 本身时,行为表现和绑定 nullItem 相同
33
32
  */
34
- parent?: VFXItem<VFXItemContent>;
35
- children: VFXItem<VFXItemContent>[];
33
+ parent?: VFXItem;
34
+ children: VFXItem[];
36
35
  /**
37
36
  * 元素的变换包含位置、旋转、缩放。
38
37
  */
@@ -45,10 +44,6 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
45
44
  * 元素动画的持续时间
46
45
  */
47
46
  duration: number;
48
- /**
49
- * 元素当前更新归一化时间,开始时为 0,结束时为 1
50
- */
51
- lifetime: number;
52
47
  /**
53
48
  * 父元素的 id
54
49
  */
@@ -81,16 +76,9 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
81
76
  /**
82
77
  * 元素创建的数据图层/粒子/模型等
83
78
  */
84
- _content?: T;
85
- /**
86
- * 元素动画是否延迟播放
87
- */
88
- delaying: boolean;
89
- /**
90
- * 元素动画的速度
91
- */
79
+ _content?: VFXItemContent;
80
+ reusable: boolean;
92
81
  type: spec.ItemType;
93
- stopped: boolean;
94
82
  props: VFXItemProps;
95
83
  components: Component[];
96
84
  itemBehaviours: ItemBehaviour[];
@@ -101,31 +89,25 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
101
89
  */
102
90
  protected visible: boolean;
103
91
  /**
104
- * 是否允许渲染,元素生命周期开始后为 true,结束时为 false
105
- * @protected
92
+ * 元素动画的速度
106
93
  */
107
- protected _contentVisible: boolean;
108
94
  private speed;
109
- static isComposition(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
110
- static isSprite(item: VFXItem<VFXItemContent>): item is VFXItem<SpriteComponent>;
111
- static isParticle(item: VFXItem<VFXItemContent>): item is VFXItem<ParticleSystem>;
112
- static isNull(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
113
- static isTree(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
114
- static isCamera(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
115
- static isExtraCamera(item: VFXItem<VFXItemContent>): item is VFXItem<CameraController>;
95
+ static isComposition(item: VFXItem): boolean;
96
+ static isSprite(item: VFXItem): boolean;
97
+ static isParticle(item: VFXItem): boolean;
98
+ static isNull(item: VFXItem): boolean;
99
+ static isTree(item: VFXItem): boolean;
100
+ static isCamera(item: VFXItem): boolean;
101
+ static isExtraCamera(item: VFXItem): boolean;
116
102
  constructor(engine: Engine, props?: VFXItemProps);
117
103
  /**
118
104
  * 返回元素创建的数据
119
105
  */
120
- get content(): T;
106
+ get content(): VFXItemContent;
121
107
  /**
122
108
  * 播放完成后是否需要再使用,是的话生命周期结束后不会 dispose
123
109
  */
124
- get reusable(): boolean;
125
- /**
126
- * 获取元素生命周期是否开始
127
- */
128
- get lifetimeStarted(): boolean;
110
+ get compositionReusable(): boolean;
129
111
  /**
130
112
  * 设置元素的动画速度
131
113
  * @param speed - 速度
@@ -146,18 +128,14 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
146
128
  * @param classConstructor - 要获取的组件类型
147
129
  * @returns 查询结果中符合类型的第一个组件
148
130
  */
149
- getComponent<T extends Component>(classConstructor: new (engine: Engine) => T): T | undefined;
131
+ getComponent<T extends Component>(classConstructor: new (engine: Engine) => T): T;
150
132
  /**
151
133
  * 获取某一类型的所有组件
152
134
  * @param classConstructor - 要获取的组件
153
135
  * @returns 一个组件列表,包含所有符合类型的组件
154
136
  */
155
137
  getComponents<T extends Component>(classConstructor: new (engine: Engine) => T): T[];
156
- setParent(vfxItem: VFXItem<VFXItemContent>): void;
157
- /**
158
- * 停止播放元素动画
159
- */
160
- stop(): void;
138
+ setParent(vfxItem: VFXItem): void;
161
139
  /**
162
140
  * 元素动画结束播放时回调函数
163
141
  * @override
@@ -210,7 +188,12 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
210
188
  */
211
189
  scale(x: number, y: number, z: number): void;
212
190
  /**
213
- * 设置元素的在画布上的像素位置, 坐标原点在 canvas 中心,x 正方向水平向右, y 正方向垂直向下
191
+ * 设置元素在画布上的像素位置
192
+ * Tips:
193
+ * - 坐标原点在 canvas 左上角,x 正方向水平向右, y 正方向垂直向下
194
+ * - 设置后会覆盖原有的位置信息
195
+ * @param x - x 坐标
196
+ * @param y - y 坐标
214
197
  */
215
198
  setPositionByPixel(x: number, y: number): void;
216
199
  /**
@@ -246,7 +229,7 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
246
229
  * @returns
247
230
  */
248
231
  isEnded(now: number): boolean;
249
- find(name: string): VFXItem<VFXItemContent> | undefined;
232
+ find(name: string): VFXItem | undefined;
250
233
  fromData(data: VFXItemData): void;
251
234
  toData(): void;
252
235
  translateByPixel(x: number, y: number): void;
@@ -267,4 +250,4 @@ export declare namespace Item {
267
250
  * @param props
268
251
  * @param composition
269
252
  */
270
- export declare function createVFXItem(props: VFXItemProps, composition: Composition): VFXItem<any>;
253
+ export declare function createVFXItem(props: VFXItemProps, composition: Composition): VFXItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-core",
3
- "version": "2.0.0-alpha.11",
3
+ "version": "2.0.0-alpha.13",
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.0.0-alpha.10",
45
+ "@galacean/effects-specification": "2.0.0-alpha.16",
46
46
  "@galacean/effects-math": "1.1.0",
47
47
  "uuid": "9.0.1"
48
48
  },
@@ -51,6 +51,6 @@
51
51
  "build": "pnpm build:declaration && pnpm build:module",
52
52
  "build:module": "rollup -c",
53
53
  "build:declaration": "tsc -d --emitDeclarationOnly",
54
- "clean": "rimraf dist && rimraf '*+(.tsbuildinfo)'"
54
+ "clean": "rimraf dist && rimraf \"*+(.tsbuildinfo)\""
55
55
  }
56
56
  }