@galacean/effects-core 2.1.0-alpha.1 → 2.1.0-alpha.11

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 (106) hide show
  1. package/dist/animation/color-playable.d.ts +26 -0
  2. package/dist/animation/index.d.ts +1 -0
  3. package/dist/asset-manager.d.ts +15 -7
  4. package/dist/asset.d.ts +4 -0
  5. package/dist/binary-asset.d.ts +2 -2
  6. package/dist/comp-vfx-item.d.ts +4 -7
  7. package/dist/components/base-render-component.d.ts +108 -0
  8. package/dist/components/effect-component.d.ts +3 -34
  9. package/dist/components/fake-3d-component.d.ts +28 -0
  10. package/dist/components/index.d.ts +3 -0
  11. package/dist/components/mesh-component.d.ts +21 -0
  12. package/dist/components/post-process-volume.d.ts +10 -11
  13. package/dist/components/shape-component.d.ts +285 -0
  14. package/dist/composition/scene-ticking.d.ts +15 -1
  15. package/dist/composition-source-manager.d.ts +5 -6
  16. package/dist/composition.d.ts +34 -23
  17. package/dist/downloader.d.ts +0 -3
  18. package/dist/effects-object.d.ts +23 -0
  19. package/dist/engine.d.ts +9 -0
  20. package/dist/events/event-emitter.d.ts +6 -0
  21. package/dist/events/types.d.ts +1 -1
  22. package/dist/index.d.ts +3 -1
  23. package/dist/index.js +20858 -17794
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +20852 -17790
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/material/material.d.ts +4 -1
  28. package/dist/math/index.d.ts +1 -1
  29. package/dist/math/translate.d.ts +1 -1
  30. package/dist/math/value-getters/color-curve.d.ts +12 -0
  31. package/dist/math/value-getters/index.d.ts +4 -0
  32. package/dist/math/value-getters/value-getter-map.d.ts +2 -0
  33. package/dist/math/{value-getter.d.ts → value-getters/value-getter.d.ts} +6 -4
  34. package/dist/math/value-getters/vector4-curve.d.ts +12 -0
  35. package/dist/plugin-system.d.ts +7 -5
  36. package/dist/plugins/cal/calculate-item.d.ts +5 -3
  37. package/dist/plugins/cal/calculate-loader.d.ts +1 -1
  38. package/dist/plugins/cal/calculate-vfx-item.d.ts +1 -1
  39. package/dist/plugins/cal/playable-graph.d.ts +4 -2
  40. package/dist/plugins/camera/camera-vfx-item-loader.d.ts +1 -1
  41. package/dist/plugins/index.d.ts +2 -7
  42. package/dist/plugins/interact/interact-item.d.ts +14 -1
  43. package/dist/plugins/interact/interact-loader.d.ts +1 -1
  44. package/dist/plugins/interact/mesh-collider.d.ts +15 -0
  45. package/dist/plugins/particle/burst.d.ts +2 -0
  46. package/dist/plugins/particle/particle-mesh.d.ts +8 -5
  47. package/dist/plugins/particle/particle-system.d.ts +3 -4
  48. package/dist/plugins/plugin.d.ts +14 -3
  49. package/dist/plugins/shape/build-adaptive-bezier.d.ts +1 -0
  50. package/dist/plugins/shape/ellipse.d.ts +79 -0
  51. package/dist/plugins/shape/graphics-path.d.ts +65 -0
  52. package/dist/plugins/shape/point-data.d.ts +6 -0
  53. package/dist/plugins/shape/point-like.d.ts +31 -0
  54. package/dist/plugins/shape/point.d.ts +58 -0
  55. package/dist/plugins/shape/poly-star.d.ts +42 -0
  56. package/dist/plugins/shape/polygon.d.ts +67 -0
  57. package/dist/plugins/shape/rectangle.d.ts +129 -0
  58. package/dist/plugins/shape/shape-path.d.ts +75 -0
  59. package/dist/plugins/shape/shape-primitive.d.ts +15 -0
  60. package/dist/plugins/shape/triangle.d.ts +89 -0
  61. package/dist/plugins/shape/triangulate.d.ts +1 -0
  62. package/dist/plugins/sprite/sprite-item.d.ts +15 -116
  63. package/dist/plugins/sprite/sprite-loader.d.ts +1 -1
  64. package/dist/plugins/sprite/sprite-mesh.d.ts +3 -4
  65. package/dist/plugins/text/text-item.d.ts +15 -5
  66. package/dist/plugins/timeline/index.d.ts +3 -0
  67. package/dist/plugins/timeline/playable-assets/color-property-playable-asset.d.ts +7 -0
  68. package/dist/plugins/timeline/playable-assets/float-property-playable-asset.d.ts +7 -0
  69. package/dist/plugins/timeline/playable-assets/index.d.ts +3 -0
  70. package/dist/plugins/{cal → timeline/playable-assets}/timeline-asset.d.ts +9 -9
  71. package/dist/plugins/timeline/playable-assets/vector4-property-playable-asset.d.ts +7 -0
  72. package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +0 -2
  73. package/dist/plugins/timeline/playables/color-property-mixer-playable.d.ts +6 -0
  74. package/dist/plugins/timeline/playables/float-property-mixer-playable.d.ts +6 -0
  75. package/dist/plugins/timeline/playables/index.d.ts +7 -0
  76. package/dist/plugins/timeline/playables/property-clip-playable.d.ts +8 -0
  77. package/dist/plugins/timeline/playables/vector4-property-mixer-playable.d.ts +6 -0
  78. package/dist/plugins/timeline/track-instance.d.ts +14 -0
  79. package/dist/plugins/timeline/track.d.ts +6 -4
  80. package/dist/plugins/timeline/tracks/color-property-track.d.ts +5 -0
  81. package/dist/plugins/timeline/tracks/float-property-track.d.ts +6 -0
  82. package/dist/plugins/timeline/tracks/index.d.ts +9 -0
  83. package/dist/plugins/timeline/tracks/material-track.d.ts +5 -0
  84. package/dist/plugins/timeline/tracks/property-track.d.ts +8 -0
  85. package/dist/plugins/timeline/tracks/sub-composition-track.d.ts +1 -1
  86. package/dist/plugins/timeline/tracks/vector4-property-track.d.ts +5 -0
  87. package/dist/render/gpu-capability.d.ts +1 -1
  88. package/dist/render/index.d.ts +0 -1
  89. package/dist/render/mesh.d.ts +1 -1
  90. package/dist/render/render-frame.d.ts +5 -1
  91. package/dist/render/renderer.d.ts +1 -1
  92. package/dist/render/semantic-map.d.ts +1 -1
  93. package/dist/render/shader.d.ts +1 -1
  94. package/dist/scene.d.ts +17 -18
  95. package/dist/serialization-helper.d.ts +3 -3
  96. package/dist/shape/geometry.d.ts +4 -4
  97. package/dist/texture/texture.d.ts +11 -2
  98. package/dist/texture/utils.d.ts +1 -2
  99. package/dist/transform.d.ts +8 -0
  100. package/dist/utils/color.d.ts +4 -5
  101. package/dist/utils/index.d.ts +1 -1
  102. package/dist/vfx-item.d.ts +67 -31
  103. package/package.json +4 -3
  104. package/dist/image-asset.d.ts +0 -5
  105. package/dist/render/global-volume.d.ts +0 -17
  106. /package/dist/plugins/timeline/{playables → playable-assets}/sub-composition-playable-asset.d.ts +0 -0
@@ -51,7 +51,6 @@ export interface MaterialProps {
51
51
  * Material 抽象类
52
52
  */
53
53
  export declare abstract class Material extends EffectsObject implements Disposable {
54
- shader: Shader;
55
54
  shaderVariant: ShaderVariant;
56
55
  shaderSource: ShaderWithSource;
57
56
  stringTags: Record<string, string>;
@@ -62,11 +61,15 @@ export declare abstract class Material extends EffectsObject implements Disposab
62
61
  readonly props: MaterialProps;
63
62
  protected destroyed: boolean;
64
63
  protected initialized: boolean;
64
+ protected shaderDirty: boolean;
65
+ private _shader;
65
66
  /**
66
67
  *
67
68
  * @param props - 材质属性
68
69
  */
69
70
  constructor(engine: Engine, props?: MaterialProps);
71
+ get shader(): Shader;
72
+ set shader(value: Shader);
70
73
  /******** effects-core 中会调用 引擎必须实现 ***********************/
71
74
  /**
72
75
  * 设置 Material 的颜色融合开关
@@ -1,4 +1,4 @@
1
1
  export * from './float16array-wrapper';
2
2
  export * from './translate';
3
3
  export * from './utils';
4
- export * from './value-getter';
4
+ export * from './value-getters';
@@ -1,6 +1,6 @@
1
1
  import { Vector3 } from '@galacean/effects-math/es/core/vector3';
2
2
  import type { ItemLinearVelOverLifetime } from '../plugins';
3
- import type { ValueGetter } from './value-getter';
3
+ import type { ValueGetter } from './value-getters';
4
4
  export declare function translatePoint(x: number, y: number): number[];
5
5
  export interface TranslateTarget {
6
6
  speedOverLifetime?: ValueGetter<number>;
@@ -0,0 +1,12 @@
1
+ import { Color } from '@galacean/effects-math/es/core/color';
2
+ import { ValueGetter } from './value-getter';
3
+ import type * as spec from '@galacean/effects-specification';
4
+ export declare class ColorCurve extends ValueGetter<Color> {
5
+ private value;
6
+ private rCurve;
7
+ private gCurve;
8
+ private bCurve;
9
+ private aCurve;
10
+ onCreate(arg: spec.ColorCurveData): void;
11
+ getValue(t: number): Color;
12
+ }
@@ -0,0 +1,4 @@
1
+ export * from './value-getter';
2
+ export * from './color-curve';
3
+ export * from './vector4-curve';
4
+ export * from './value-getter-map';
@@ -0,0 +1,2 @@
1
+ import { ValueGetter } from './value-getter';
2
+ export declare function createValueGetter(args: any): ValueGetter<any>;
@@ -2,9 +2,9 @@ import type { Vector2 } from '@galacean/effects-math/es/core/vector2';
2
2
  import { Vector3 } from '@galacean/effects-math/es/core/vector3';
3
3
  import { Quaternion } from '@galacean/effects-math/es/core/quaternion';
4
4
  import * as spec from '@galacean/effects-specification';
5
- import type { ColorStop } from '../utils';
6
- import type { BezierEasing } from './bezier';
7
- import { BezierPath, BezierQuat } from './bezier';
5
+ import type { ColorStop } from '../../utils';
6
+ import type { BezierEasing } from '../bezier';
7
+ import { BezierPath, BezierQuat } from '../bezier';
8
8
  interface KeyFrameMeta {
9
9
  curves: ValueGetter<any>[];
10
10
  index: number;
@@ -97,8 +97,11 @@ export declare class BezierCurve extends ValueGetter<number> {
97
97
  timeInterval: number;
98
98
  valueInterval: number;
99
99
  curve: BezierEasing;
100
+ timeStart: number;
101
+ timeEnd: number;
100
102
  }>;
101
103
  keys: number[][];
104
+ keyTimeData: string[];
102
105
  onCreate(props: spec.BezierKeyframeValue[]): void;
103
106
  getValue(time: number): number;
104
107
  getIntegrateValue(t0: number, t1: number, ts?: number): number;
@@ -142,7 +145,6 @@ export declare class BezierCurveQuat extends ValueGetter<Quaternion> {
142
145
  getPercValue(curveKey: string, time: number): number;
143
146
  getMaxTime(): number;
144
147
  }
145
- export declare function createValueGetter(args: any): ValueGetter<any>;
146
148
  export declare function getKeyFrameMetaByRawValue(meta: KeyFrameMeta, value?: [type: spec.ValueType, value: any]): void;
147
149
  export declare function createKeyFrameMeta(): {
148
150
  curves: never[];
@@ -0,0 +1,12 @@
1
+ import { Vector4 } from '@galacean/effects-math/es/core/vector4';
2
+ import { ValueGetter } from './value-getter';
3
+ import type * as spec from '@galacean/effects-specification';
4
+ export declare class Vector4Curve extends ValueGetter<Vector4> {
5
+ private value;
6
+ private xCurve;
7
+ private yCurve;
8
+ private zCurve;
9
+ private wCurve;
10
+ onCreate(arg: spec.Vector4CurveData): void;
11
+ getValue(t: number): Vector4;
12
+ }
@@ -3,8 +3,7 @@ import type { Composition } from './composition';
3
3
  import type { Plugin, PluginConstructor } from './plugins';
4
4
  import type { RenderFrame, Renderer } from './render';
5
5
  import type { Scene, SceneLoadOptions } from './scene';
6
- import type { VFXItemConstructor, VFXItemProps } from './vfx-item';
7
- import { VFXItem } from './vfx-item';
6
+ import type { VFXItemConstructor } from './vfx-item';
8
7
  export declare const pluginLoaderMap: Record<string, PluginConstructor>;
9
8
  export declare const defaultPlugins: string[];
10
9
  export type PrecompileOptions = {
@@ -25,9 +24,12 @@ export declare class PluginSystem {
25
24
  initializeComposition(composition: Composition, scene: Scene): void;
26
25
  destroyComposition(comp: Composition): void;
27
26
  resetComposition(comp: Composition, renderFrame: RenderFrame): void;
28
- createPluginItem(name: string, props: VFXItemProps, composition: Composition): VFXItem;
29
27
  processRawJSON(json: spec.JSONScene, options: SceneLoadOptions): Promise<void[]>;
28
+ processAssets(json: spec.JSONScene, options?: SceneLoadOptions): Promise<{
29
+ assets: spec.AssetBase[];
30
+ loadedAssets: unknown[];
31
+ }[]>;
32
+ precompile(compositions: spec.CompositionData[], renderer: Renderer, options?: PrecompileOptions): Promise<unknown[]>;
33
+ loadResources(scene: Scene, options: SceneLoadOptions): Promise<unknown[]>;
30
34
  private callStatic;
31
- precompile(compositions: spec.CompositionData[], renderer: Renderer, options?: PrecompileOptions): Promise<void[]>;
32
- loadResources(scene: Scene, options: SceneLoadOptions): Promise<void[]>;
33
35
  }
@@ -1,7 +1,8 @@
1
- import type { Euler, Vector3 } from '@galacean/effects-math/es/core/index';
1
+ import type { Euler } from '@galacean/effects-math/es/core/euler';
2
+ import type { Vector3 } from '@galacean/effects-math/es/core/vector3';
2
3
  import type { ValueGetter } from '../../math';
3
- import { TrackAsset } from '../timeline/track';
4
- import type { TimelineAsset } from './timeline-asset';
4
+ import { TrackAsset } from '../timeline';
5
+ import type { TimelineAsset } from '../timeline';
5
6
  /**
6
7
  * 基础位移属性数据
7
8
  */
@@ -22,5 +23,6 @@ export type ItemLinearVelOverLifetime = {
22
23
  * @since 2.0.0
23
24
  */
24
25
  export declare class ObjectBindingTrack extends TrackAsset {
26
+ updateAnimatedObject(): void;
25
27
  create(timelineAsset: TimelineAsset): void;
26
28
  }
@@ -1,3 +1,3 @@
1
- import { AbstractPlugin } from '../index';
1
+ import { AbstractPlugin } from '../plugin';
2
2
  export declare class CalculateLoader extends AbstractPlugin {
3
3
  }
@@ -42,7 +42,7 @@ export declare class TransformAnimationPlayable extends AnimationPlayable {
42
42
  startSpeed: number;
43
43
  data: TransformPlayableAssetData;
44
44
  private velocity;
45
- private binding;
45
+ private boundObject;
46
46
  start(): void;
47
47
  processFrame(context: FrameContext): void;
48
48
  /**
@@ -22,7 +22,7 @@ export declare class PlayableGraph {
22
22
  export declare class Playable implements Disposable {
23
23
  onPlayablePlayFlag: boolean;
24
24
  onPlayablePauseFlag: boolean;
25
- overrideTimeNextEvaluation: boolean;
25
+ private duration;
26
26
  private destroyed;
27
27
  private inputs;
28
28
  private inputOuputPorts;
@@ -50,6 +50,8 @@ export declare class Playable implements Disposable {
50
50
  setInputWeight(inputIndex: number, weight: number): void;
51
51
  setTime(time: number): void;
52
52
  getTime(): number;
53
+ setDuration(duration: number): void;
54
+ getDuration(): number;
53
55
  getPlayState(): PlayState;
54
56
  setTraversalMode(mode: PlayableTraversalMode): void;
55
57
  getTraversalMode(): PlayableTraversalMode;
@@ -82,7 +84,7 @@ export declare class PlayableOutput {
82
84
  protected time: number;
83
85
  private sourceOutputPort;
84
86
  constructor();
85
- setSourcePlayeble(playable: Playable, port?: number): void;
87
+ setSourcePlayable(playable: Playable, port?: number): void;
86
88
  getSourceOutputPort(): number;
87
89
  setUserData(value: object): void;
88
90
  getUserData(): object;
@@ -1,3 +1,3 @@
1
- import { AbstractPlugin } from '../index';
1
+ import { AbstractPlugin } from '../plugin';
2
2
  export declare class CameraVFXItemLoader extends AbstractPlugin {
3
3
  }
@@ -7,6 +7,7 @@ export * from './interact/interact-loader';
7
7
  export * from './interact/interact-mesh';
8
8
  export * from './interact/interact-vfx-item';
9
9
  export * from './interact/interact-item';
10
+ export * from './interact/mesh-collider';
10
11
  export * from './sprite/sprite-loader';
11
12
  export * from './sprite/sprite-item';
12
13
  export * from './sprite/sprite-mesh';
@@ -18,11 +19,5 @@ export * from './particle/particle-system-renderer';
18
19
  export * from './cal/calculate-loader';
19
20
  export * from './cal/calculate-vfx-item';
20
21
  export * from './cal/calculate-item';
21
- export * from './timeline/track';
22
- export * from './timeline/tracks/transform-track';
23
- export * from './timeline/tracks/activation-track';
24
- export * from './timeline/tracks/sprite-color-track';
25
- export * from './timeline/tracks/sub-composition-track';
26
- export * from './timeline/playables/sub-composition-playable-asset';
27
- export * from './cal/timeline-asset';
22
+ export * from './timeline';
28
23
  export * from './text';
@@ -6,6 +6,7 @@ import { RendererComponent } from '../../components';
6
6
  import type { DragEventType } from './interact-vfx-item';
7
7
  import type { Renderer } from '../../render';
8
8
  /**
9
+ * 交互组件
9
10
  * @since 2.0.0
10
11
  */
11
12
  export declare class InteractComponent extends RendererComponent {
@@ -22,12 +23,24 @@ export declare class InteractComponent extends RendererComponent {
22
23
  * 拖拽的距离映射系数,越大越容易拖动
23
24
  */
24
25
  dragRatio: number[];
26
+ /**
27
+ * 拖拽X范围
28
+ */
29
+ dragRange: {
30
+ dxRange: [min: number, max: number];
31
+ dyRange: [min: number, max: number];
32
+ };
25
33
  /** 是否响应点击和拖拽交互事件 */
26
34
  private _interactive;
27
- private hasBeenAddedToComposition;
28
35
  set interactive(enable: boolean);
29
36
  get interactive(): boolean;
37
+ getDragRangeX(): [min: number, max: number];
38
+ setDragRangeX(min: number, max: number): void;
39
+ getDragRangeY(): [min: number, max: number];
40
+ setDragRangeY(min: number, max: number): void;
30
41
  onStart(): void;
42
+ onDisable(): void;
43
+ onEnable(): void;
31
44
  onUpdate(dt: number): void;
32
45
  render(renderer: Renderer): void;
33
46
  onDestroy(): void;
@@ -1,3 +1,3 @@
1
- import { AbstractPlugin } from '../index';
1
+ import { AbstractPlugin } from '../plugin';
2
2
  export declare class InteractLoader extends AbstractPlugin {
3
3
  }
@@ -0,0 +1,15 @@
1
+ import type { Geometry } from '../../render/geometry';
2
+ import type { BoundingBoxTriangle } from './click-handler';
3
+ import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
4
+ /**
5
+ *
6
+ */
7
+ export declare class MeshCollider {
8
+ private boundingBoxData;
9
+ private geometry;
10
+ private triangles;
11
+ getBoundingBoxData(): BoundingBoxTriangle;
12
+ getBoundingBox(): BoundingBoxTriangle;
13
+ setGeometry(geometry: Geometry, worldMatrix?: Matrix4): void;
14
+ private geometryToTriangles;
15
+ }
@@ -7,6 +7,8 @@ interface BurstOptions {
7
7
  probability: number;
8
8
  }
9
9
  export declare class Burst {
10
+ once: boolean;
11
+ disabled: boolean;
10
12
  private now;
11
13
  private index;
12
14
  private internalCycles;
@@ -2,7 +2,6 @@ import type * as spec from '@galacean/effects-specification';
2
2
  import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
3
3
  import { Vector2 } from '@galacean/effects-math/es/core/vector2';
4
4
  import { Vector3 } from '@galacean/effects-math/es/core/vector3';
5
- import { Matrix3 } from '@galacean/effects-math/es/core/matrix3';
6
5
  import type { Engine } from '../../engine';
7
6
  import { ValueGetter } from '../../math';
8
7
  import type { GPUCapability, SharedShaderWithSource } from '../../render';
@@ -139,6 +138,10 @@ export declare class ParticleMesh implements ParticleMeshData {
139
138
  readonly textureOffsets: number[];
140
139
  readonly maxCount: number;
141
140
  readonly anchor: Vector2;
141
+ private cachedRotationVector3;
142
+ private cachedRotationMatrix;
143
+ private cachedLinearMove;
144
+ private tempMatrix3;
142
145
  VERT_MAX_KEY_FRAME_COUNT: number;
143
146
  constructor(engine: Engine, props: ParticleMeshProps);
144
147
  getPointColor(index: number): number[];
@@ -146,12 +149,12 @@ export declare class ParticleMesh implements ParticleMeshData {
146
149
  resetGeometryData(geometry: Geometry): void;
147
150
  onUpdate(dt: number): void;
148
151
  minusTime(time: number): void;
149
- calculateTranslation(velocity: Vector3, t0: number, t1: number, duration: number): Vector3;
150
- transformFromRotation(rot: Vector3, life: number, dur: number, aSeed: number): Matrix3;
151
- mat3FromRotation(rotation: Vector3): Matrix3;
152
- calLinearMov(time: number, duration: number, aSeed: number): Vector3;
153
152
  removePoint(index: number): void;
154
153
  setPoint(index: number, point: Point): void;
154
+ private applyTranslation;
155
+ private applyRotation;
156
+ private applyLinearMove;
157
+ private expandArray;
155
158
  }
156
159
  export declare function getParticleMeshShader(item: spec.ParticleItem, gpuCapability: GPUCapability, env?: string): {
157
160
  shader: SharedShaderWithSource;
@@ -6,10 +6,9 @@ import { Component } from '../../components';
6
6
  import type { Engine } from '../../engine';
7
7
  import type { ValueGetter } from '../../math';
8
8
  import type { Mesh } from '../../render';
9
- import type { ShapeGenerator } from '../../shape';
9
+ import type { ShapeGenerator, ShapeParticle } from '../../shape';
10
10
  import { Texture } from '../../texture';
11
11
  import { Transform } from '../../transform';
12
- import { type color } from '../../utils';
13
12
  import type { BoundingBoxSphere, HitTestCustomParams } from '../interact/click-handler';
14
13
  import { Burst } from './burst';
15
14
  import type { Point } from './particle-mesh';
@@ -24,7 +23,7 @@ type ParticleOptions = {
24
23
  startSpeed: ValueGetter<number>;
25
24
  startLifetime: ValueGetter<number>;
26
25
  startDelay: ValueGetter<number>;
27
- startColor: ValueGetter<color>;
26
+ startColor: ValueGetter<spec.RGBAColorValue>;
28
27
  start3DRotation?: boolean;
29
28
  startRotationX?: ValueGetter<number>;
30
29
  startRotationY?: ValueGetter<number>;
@@ -188,7 +187,7 @@ export declare class ParticleSystem extends Component {
188
187
  * 通过粒子参数获取当前时刻粒子的位置
189
188
  */
190
189
  getPointPosition(point: Point): Vector3;
191
- initPoint(data: Record<string, any>): Point;
190
+ initPoint(data: ShapeParticle): Point;
192
191
  addBurst(burst: Burst, offsets: vec3[]): number;
193
192
  removeBurst(index: number): void;
194
193
  createPoint(lifetime: number): Point;
@@ -6,7 +6,7 @@ import type { Composition } from '../composition';
6
6
  export interface Plugin {
7
7
  /**
8
8
  * plugin 的数组内排序,按照升序排列
9
- * 默认为100
9
+ * @default 100
10
10
  */
11
11
  order: number;
12
12
  name: string;
@@ -88,7 +88,7 @@ export declare abstract class AbstractPlugin implements Plugin {
88
88
  order: number;
89
89
  name: string;
90
90
  /***
91
- * player.loadScene 函数调用的时候会触发此函数,
91
+ * loadScene 函数调用的时候会触发此函数,
92
92
  * 此阶段可以对资源 JSON 进行处理,替换调 JSON 中的数据,或者直接终止加载流程
93
93
  * 一旦被 reject,加载过程将失败
94
94
  * @param json 动画资源
@@ -96,7 +96,18 @@ export declare abstract class AbstractPlugin implements Plugin {
96
96
  */
97
97
  static processRawJSON: (json: spec.JSONScene, options: SceneLoadOptions) => Promise<void>;
98
98
  /**
99
- * player.loadScene 函数调用的时候会触发此函数,
99
+ * loadScene 函数调用的时候会触发此函数,
100
+ * 此阶段可以加载插件所需类型资源,并返回原始资源和加载后的资源。
101
+ * @param json
102
+ * @param options
103
+ * @returns
104
+ */
105
+ static processAssets: (json: spec.JSONScene, options?: SceneLoadOptions) => Promise<{
106
+ assets: spec.AssetBase[];
107
+ loadedAssets: unknown[];
108
+ }>;
109
+ /**
110
+ * loadScene 函数调用的时候会触发此函数,
100
111
  * 此阶段时,json 中的图片和二进制已经被加载完成,可以对加载好的资源做进一步处理,
101
112
  * 如果 promise 被 reject, loadScene 函数同样会被 reject,表示场景加载失败。
102
113
  * 请记住,整个 load 阶段都不要创建 GL 相关的对象,只创建 JS 对象
@@ -0,0 +1 @@
1
+ export declare function buildAdaptiveBezier(points: number[], sX: number, sY: number, cp1x: number, cp1y: number, cp2x: number, cp2y: number, eX: number, eY: number, smoothness?: number): number[];
@@ -0,0 +1,79 @@
1
+ import { ShapePrimitive } from './shape-primitive';
2
+ /**
3
+ * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for containers.
4
+ */
5
+ export declare class Ellipse extends ShapePrimitive {
6
+ /**
7
+ * The X coordinate of the center of this ellipse
8
+ * @default 0
9
+ */
10
+ x: number;
11
+ /**
12
+ * The Y coordinate of the center of this ellipse
13
+ * @default 0
14
+ */
15
+ y: number;
16
+ /**
17
+ * The half width of this ellipse
18
+ * @default 0
19
+ */
20
+ halfWidth: number;
21
+ /**
22
+ * The half height of this ellipse
23
+ * @default 0
24
+ */
25
+ halfHeight: number;
26
+ /**
27
+ * The type of the object, mainly used to avoid `instanceof` checks
28
+ * @default 'ellipse'
29
+ */
30
+ readonly type = "ellipse";
31
+ /**
32
+ * @param x - The X coordinate of the center of this ellipse
33
+ * @param y - The Y coordinate of the center of this ellipse
34
+ * @param halfWidth - The half width of this ellipse
35
+ * @param halfHeight - The half height of this ellipse
36
+ */
37
+ constructor(x?: number, y?: number, halfWidth?: number, halfHeight?: number);
38
+ /**
39
+ * Creates a clone of this Ellipse instance
40
+ * @returns {Ellipse} A copy of the ellipse
41
+ */
42
+ clone(): Ellipse;
43
+ /**
44
+ * Checks whether the x and y coordinates given are contained within this ellipse
45
+ * @param x - The X coordinate of the point to test
46
+ * @param y - The Y coordinate of the point to test
47
+ * @returns Whether the x/y coords are within this ellipse
48
+ */
49
+ contains(x: number, y: number): boolean;
50
+ /**
51
+ * Checks whether the x and y coordinates given are contained within this ellipse including stroke
52
+ * @param x - The X coordinate of the point to test
53
+ * @param y - The Y coordinate of the point to test
54
+ * @param width
55
+ * @returns Whether the x/y coords are within this ellipse
56
+ */
57
+ strokeContains(x: number, y: number, width: number): boolean;
58
+ /**
59
+ * Returns the framing rectangle of the ellipse as a Rectangle object
60
+ * @param out
61
+ * @returns The framing rectangle
62
+ */
63
+ /**
64
+ * Copies another ellipse to this one.
65
+ * @param ellipse - The ellipse to copy from.
66
+ * @returns Returns itself.
67
+ */
68
+ copyFrom(ellipse: Ellipse): this;
69
+ /**
70
+ * Copies this ellipse to another one.
71
+ * @param ellipse - The ellipse to copy to.
72
+ * @returns Returns given parameter.
73
+ */
74
+ copyTo(ellipse: Ellipse): Ellipse;
75
+ getX(): number;
76
+ getY(): number;
77
+ build(points: number[]): number[];
78
+ triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
79
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Based on:
3
+ * https://github.com/pixijs/pixijs/blob/dev/src/scene/graphics/shared/path/GraphicsPath.ts
4
+ */
5
+ import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
6
+ import { ShapePath } from './shape-path';
7
+ import type { StarType } from './poly-star';
8
+ export declare class GraphicsPath {
9
+ instructions: PathInstruction[];
10
+ private dirty;
11
+ private _shapePath;
12
+ /**
13
+ * Provides access to the internal shape path, ensuring it is up-to-date with the current instructions.
14
+ * @returns The `ShapePath` instance associated with this `GraphicsPath`.
15
+ */
16
+ get shapePath(): ShapePath;
17
+ /**
18
+ * Adds a cubic Bezier curve to the path.
19
+ * It requires three points: the first two are control points and the third one is the end point.
20
+ * The starting point is the last point in the current path.
21
+ * @param cp1x - The x-coordinate of the first control point.
22
+ * @param cp1y - The y-coordinate of the first control point.
23
+ * @param cp2x - The x-coordinate of the second control point.
24
+ * @param cp2y - The y-coordinate of the second control point.
25
+ * @param x - The x-coordinate of the end point.
26
+ * @param y - The y-coordinate of the end point.
27
+ * @param smoothness - Optional parameter to adjust the smoothness of the curve.
28
+ * @returns The instance of the current object for chaining.
29
+ */
30
+ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): GraphicsPath;
31
+ /**
32
+ * Sets the starting point for a new sub-path. Any subsequent drawing commands are considered part of this path.
33
+ * @param x - The x-coordinate for the starting point.
34
+ * @param y - The y-coordinate for the starting point.
35
+ * @returns The instance of the current object for chaining.
36
+ */
37
+ moveTo(x: number, y: number): GraphicsPath;
38
+ /**
39
+ * Draws an ellipse at the specified location and with the given x and y radii.
40
+ * An optional transformation can be applied, allowing for rotation, scaling, and translation.
41
+ * @param x - The x-coordinate of the center of the ellipse.
42
+ * @param y - The y-coordinate of the center of the ellipse.
43
+ * @param radiusX - The horizontal radius of the ellipse.
44
+ * @param radiusY - The vertical radius of the ellipse.
45
+ * @param transform - An optional `Matrix` object to apply a transformation to the ellipse. This can include rotations.
46
+ * @returns The instance of the current object for chaining.
47
+ */
48
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, transform?: Matrix4): this;
49
+ /**
50
+ * Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
51
+ * @param x - The x-coordinate of the top-left corner of the rectangle.
52
+ * @param y - The y-coordinate of the top-left corner of the rectangle.
53
+ * @param w - The width of the rectangle.
54
+ * @param h - The height of the rectangle.
55
+ * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
56
+ * @returns The instance of the current object for chaining.
57
+ */
58
+ rect(x: number, y: number, w: number, h: number, transform?: Matrix4): this;
59
+ polyStar(pointCount: number, outerRadius: number, innerRadius: number, outerRoundness: number, innerRoundness: number, starType: StarType, transform?: Matrix4): this;
60
+ clear(): GraphicsPath;
61
+ }
62
+ export interface PathInstruction {
63
+ action: 'moveTo' | 'lineTo' | 'quadraticCurveTo' | 'bezierCurveTo' | 'arc' | 'closePath' | 'addPath' | 'arcTo' | 'ellipse' | 'rect' | 'roundRect' | 'arcToSvg' | 'poly' | 'circle' | 'regularPoly' | 'roundPoly' | 'roundShape' | 'filletRect' | 'chamferRect' | 'polyStar';
64
+ data: any[];
65
+ }
@@ -0,0 +1,6 @@
1
+ export interface PointData {
2
+ /** X coord */
3
+ x: number;
4
+ /** Y coord */
5
+ y: number;
6
+ }
@@ -0,0 +1,31 @@
1
+ import type { PointData } from './point-data';
2
+ /**
3
+ * Common interface for points. Both Point and ObservablePoint implement it
4
+ */
5
+ export interface PointLike extends PointData {
6
+ /**
7
+ * Copies x and y from the given point
8
+ * @param p - The point to copy from
9
+ * @returns Returns itself.
10
+ */
11
+ copyFrom: (p: PointData) => this;
12
+ /**
13
+ * Copies x and y into the given point
14
+ * @param p - The point to copy.fds
15
+ * @returns Given point with values updated
16
+ */
17
+ copyTo: <T extends PointLike>(p: T) => T;
18
+ /**
19
+ * Returns true if the given point is equal to this point
20
+ * @param p - The point to check
21
+ * @returns Whether the given point equal to this point
22
+ */
23
+ equals: (p: PointData) => boolean;
24
+ /**
25
+ * Sets the point to a new x and y position.
26
+ * If y is omitted, both x and y will be set to x.
27
+ * @param {number} [x=0] - position of the point on the x axis
28
+ * @param {number} [y=x] - position of the point on the y axis
29
+ */
30
+ set: (x?: number, y?: number) => void;
31
+ }
@@ -0,0 +1,58 @@
1
+ import type { PointData } from './point-data';
2
+ import type { PointLike } from './point-like';
3
+ /**
4
+ * The Point object represents a location in a two-dimensional coordinate system, where `x` represents
5
+ * the position on the horizontal axis and `y` represents the position on the vertical axis.
6
+ */
7
+ export declare class Point implements PointLike {
8
+ /**
9
+ * Position of the point on the x axis
10
+ */
11
+ x: number;
12
+ /**
13
+ * Position of the point on the y axis
14
+ */
15
+ y: number;
16
+ /**
17
+ * Creates a new `Point`
18
+ * @param {number} [x=0] - position of the point on the x axis
19
+ * @param {number} [y=0] - position of the point on the y axis
20
+ */
21
+ constructor(x?: number, y?: number);
22
+ /**
23
+ * Creates a clone of this point
24
+ * @returns A clone of this point
25
+ */
26
+ clone(): Point;
27
+ /**
28
+ * Copies `x` and `y` from the given point into this point
29
+ * @param p - The point to copy from
30
+ * @returns The point instance itself
31
+ */
32
+ copyFrom(p: PointData): this;
33
+ /**
34
+ * Copies this point's x and y into the given point (`p`).
35
+ * @param p - The point to copy to. Can be any of type that is or extends `PointData`
36
+ * @returns The point (`p`) with values updated
37
+ */
38
+ copyTo<T extends PointLike>(p: T): T;
39
+ /**
40
+ * Accepts another point (`p`) and returns `true` if the given point is equal to this point
41
+ * @param p - The point to check
42
+ * @returns Returns `true` if both `x` and `y` are equal
43
+ */
44
+ equals(p: PointData): boolean;
45
+ /**
46
+ * Sets the point to a new `x` and `y` position.
47
+ * If `y` is omitted, both `x` and `y` will be set to `x`.
48
+ * @param {number} [x=0] - position of the point on the `x` axis
49
+ * @param {number} [y=x] - position of the point on the `y` axis
50
+ * @returns The point instance itself
51
+ */
52
+ set(x?: number, y?: number): this;
53
+ /**
54
+ * A static Point object with `x` and `y` values of `0`. Can be used to avoid creating new objects multiple times.
55
+ * @readonly
56
+ */
57
+ static get shared(): Point;
58
+ }