@galacean/effects-core 2.1.0-alpha.6 → 2.1.0-alpha.7
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/dist/animation/color-playable.d.ts +26 -0
- package/dist/animation/index.d.ts +1 -0
- package/dist/asset-manager.d.ts +8 -1
- package/dist/asset.d.ts +4 -0
- package/dist/comp-vfx-item.d.ts +1 -4
- package/dist/components/base-render-component.d.ts +99 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/shape-component.d.ts +39 -5
- package/dist/composition/scene-ticking.d.ts +1 -1
- package/dist/composition-source-manager.d.ts +4 -5
- package/dist/composition.d.ts +2 -5
- package/dist/downloader.d.ts +0 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +18820 -18200
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18818 -18200
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-system.d.ts +7 -5
- package/dist/plugins/cal/calculate-item.d.ts +4 -3
- package/dist/plugins/cal/calculate-loader.d.ts +1 -1
- package/dist/plugins/cal/calculate-vfx-item.d.ts +1 -1
- package/dist/plugins/camera/camera-vfx-item-loader.d.ts +1 -1
- package/dist/plugins/index.d.ts +1 -7
- package/dist/plugins/interact/interact-loader.d.ts +1 -1
- package/dist/plugins/particle/particle-system.d.ts +1 -2
- package/dist/plugins/plugin.d.ts +14 -3
- package/dist/plugins/shape/ellipse.d.ts +79 -0
- package/dist/plugins/shape/graphics-path.d.ts +2 -0
- package/dist/plugins/shape/point-like.d.ts +31 -0
- package/dist/plugins/shape/point.d.ts +58 -0
- package/dist/plugins/shape/polygon.d.ts +12 -5
- package/dist/plugins/shape/shape-path.d.ts +25 -3
- package/dist/plugins/shape/shape-primitive.d.ts +18 -0
- package/dist/plugins/sprite/sprite-item.d.ts +17 -111
- package/dist/plugins/sprite/sprite-loader.d.ts +1 -1
- package/dist/plugins/sprite/sprite-mesh.d.ts +3 -4
- package/dist/plugins/text/text-item.d.ts +15 -5
- package/dist/plugins/timeline/index.d.ts +3 -0
- package/dist/plugins/timeline/playable-assets/float-property-playable-asset.d.ts +7 -0
- package/dist/plugins/timeline/playable-assets/index.d.ts +3 -0
- package/dist/plugins/{cal → timeline/playable-assets}/timeline-asset.d.ts +4 -4
- package/dist/plugins/timeline/playables/float-property-clip-playable.d.ts +8 -0
- package/dist/plugins/timeline/playables/float-property-mixer-playable.d.ts +6 -0
- package/dist/plugins/timeline/playables/index.d.ts +5 -0
- package/dist/plugins/timeline/track.d.ts +4 -2
- package/dist/plugins/timeline/tracks/float-property-track.d.ts +8 -0
- package/dist/plugins/timeline/tracks/index.d.ts +5 -0
- package/dist/plugins/timeline/tracks/sub-composition-track.d.ts +1 -1
- package/dist/render/mesh.d.ts +1 -1
- package/dist/render/renderer.d.ts +1 -1
- package/dist/render/semantic-map.d.ts +1 -1
- package/dist/serialization-helper.d.ts +3 -3
- package/dist/texture/texture.d.ts +9 -0
- package/dist/utils/color.d.ts +4 -5
- package/dist/utils/index.d.ts +1 -1
- package/dist/vfx-item.d.ts +0 -1
- package/package.json +1 -1
- package/dist/image-asset.d.ts +0 -5
- /package/dist/plugins/timeline/{playables → playable-assets}/sub-composition-playable-asset.d.ts +0 -0
package/dist/plugin-system.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
4
|
-
import type { TimelineAsset } from '
|
|
4
|
+
import { TrackAsset } from '../timeline';
|
|
5
|
+
import type { TimelineAsset } from '../timeline';
|
|
5
6
|
/**
|
|
6
7
|
* 基础位移属性数据
|
|
7
8
|
*/
|
|
@@ -42,7 +42,7 @@ export declare class TransformAnimationPlayable extends AnimationPlayable {
|
|
|
42
42
|
startSpeed: number;
|
|
43
43
|
data: TransformPlayableAssetData;
|
|
44
44
|
private velocity;
|
|
45
|
-
private
|
|
45
|
+
private boundObject;
|
|
46
46
|
start(): void;
|
|
47
47
|
processFrame(context: FrameContext): void;
|
|
48
48
|
/**
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -18,11 +18,5 @@ export * from './particle/particle-system-renderer';
|
|
|
18
18
|
export * from './cal/calculate-loader';
|
|
19
19
|
export * from './cal/calculate-vfx-item';
|
|
20
20
|
export * from './cal/calculate-item';
|
|
21
|
-
export * from './timeline
|
|
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';
|
|
21
|
+
export * from './timeline';
|
|
28
22
|
export * from './text';
|
|
@@ -9,7 +9,6 @@ import type { Mesh } from '../../render';
|
|
|
9
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<
|
|
26
|
+
startColor: ValueGetter<spec.RGBAColorValue>;
|
|
28
27
|
start3DRotation?: boolean;
|
|
29
28
|
startRotationX?: ValueGetter<number>;
|
|
30
29
|
startRotationY?: ValueGetter<number>;
|
package/dist/plugins/plugin.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { Composition } from '../composition';
|
|
|
6
6
|
export interface Plugin {
|
|
7
7
|
/**
|
|
8
8
|
* plugin 的数组内排序,按照升序排列
|
|
9
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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,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
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Based on:
|
|
3
3
|
* https://github.com/pixijs/pixijs/blob/dev/src/scene/graphics/shared/path/GraphicsPath.ts
|
|
4
4
|
*/
|
|
5
|
+
import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
|
|
5
6
|
import { ShapePath } from './shape-path';
|
|
6
7
|
export declare class GraphicsPath {
|
|
7
8
|
instructions: PathInstruction[];
|
|
@@ -27,6 +28,7 @@ export declare class GraphicsPath {
|
|
|
27
28
|
*/
|
|
28
29
|
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): GraphicsPath;
|
|
29
30
|
moveTo(x: number, y: number): GraphicsPath;
|
|
31
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, matrix?: Matrix4): this;
|
|
30
32
|
clear(): GraphicsPath;
|
|
31
33
|
}
|
|
32
34
|
export interface PathInstruction {
|
|
@@ -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
|
+
}
|
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
* Based on:
|
|
3
3
|
* https://github.com/pixijs/pixijs/blob/dev/src/maths/shapes/Polygon.ts
|
|
4
4
|
*/
|
|
5
|
+
import { ShapePrimitive } from './shape-primitive';
|
|
5
6
|
import type { PointData } from './point-data';
|
|
6
7
|
/**
|
|
7
8
|
* A class to define a shape via user defined coordinates.
|
|
8
9
|
*/
|
|
9
|
-
export declare class Polygon {
|
|
10
|
-
/**
|
|
10
|
+
export declare class Polygon extends ShapePrimitive {
|
|
11
|
+
/**
|
|
12
|
+
* An array of the points of this polygon.
|
|
13
|
+
*/
|
|
11
14
|
points: number[];
|
|
12
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* `false` after moveTo, `true` after `closePath`. In all other cases it is `true`.
|
|
17
|
+
*/
|
|
13
18
|
closePath: boolean;
|
|
14
19
|
constructor(points: PointData[] | number[]);
|
|
15
20
|
constructor(...points: PointData[] | number[]);
|
|
@@ -51,10 +56,12 @@ export declare class Polygon {
|
|
|
51
56
|
* Get the first X coordinate of the polygon
|
|
52
57
|
* @readonly
|
|
53
58
|
*/
|
|
54
|
-
|
|
59
|
+
getX(): number;
|
|
55
60
|
/**
|
|
56
61
|
* Get the first Y coordinate of the polygon
|
|
57
62
|
* @readonly
|
|
58
63
|
*/
|
|
59
|
-
|
|
64
|
+
getY(): number;
|
|
65
|
+
build(points: number[]): void;
|
|
66
|
+
triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
60
67
|
}
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
* Based on:
|
|
3
3
|
* https://github.com/pixijs/pixijs/blob/dev/src/scene/graphics/shared/path/ShapePath.ts
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
|
|
6
6
|
import { Polygon } from './polygon';
|
|
7
7
|
import type { GraphicsPath } from './graphics-path';
|
|
8
|
+
import type { ShapePrimitive } from './shape-primitive';
|
|
8
9
|
export declare class ShapePath {
|
|
9
10
|
private graphicsPath;
|
|
10
11
|
currentPoly: Polygon | null;
|
|
11
12
|
shapePrimitives: {
|
|
12
|
-
shape:
|
|
13
|
-
transform?:
|
|
13
|
+
shape: ShapePrimitive;
|
|
14
|
+
transform?: Matrix4;
|
|
14
15
|
}[];
|
|
15
16
|
constructor(graphicsPath: GraphicsPath);
|
|
16
17
|
/** Builds the path. */
|
|
@@ -30,6 +31,27 @@ export declare class ShapePath {
|
|
|
30
31
|
*/
|
|
31
32
|
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): ShapePath;
|
|
32
33
|
moveTo(x: number, y: number): ShapePath;
|
|
34
|
+
/**
|
|
35
|
+
* Draws an ellipse at the specified location and with the given x and y radii.
|
|
36
|
+
* An optional transformation can be applied, allowing for rotation, scaling, and translation.
|
|
37
|
+
* @param x - The x-coordinate of the center of the ellipse.
|
|
38
|
+
* @param y - The y-coordinate of the center of the ellipse.
|
|
39
|
+
* @param radiusX - The horizontal radius of the ellipse.
|
|
40
|
+
* @param radiusY - The vertical radius of the ellipse.
|
|
41
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the ellipse. This can include rotations.
|
|
42
|
+
* @returns The instance of the current object for chaining.
|
|
43
|
+
*/
|
|
44
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, transform?: Matrix4): this;
|
|
45
|
+
/**
|
|
46
|
+
* Draws a given shape on the canvas.
|
|
47
|
+
* This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
|
|
48
|
+
* An optional transformation matrix can be applied to the shape, allowing for complex transformations.
|
|
49
|
+
* @param shape - The shape to draw, defined as a `ShapePrimitive` object.
|
|
50
|
+
* @param matrix - An optional `Matrix` for transforming the shape. This can include rotations,
|
|
51
|
+
* scaling, and translations.
|
|
52
|
+
* @returns The instance of the current object for chaining.
|
|
53
|
+
*/
|
|
54
|
+
drawShape(shape: ShapePrimitive, matrix?: Matrix4): this;
|
|
33
55
|
/**
|
|
34
56
|
* Starts a new polygon path from the specified starting point.
|
|
35
57
|
* This method initializes a new polygon or ends the current one if it exists.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare abstract class ShapePrimitive {
|
|
2
|
+
/** Checks whether the x and y coordinates passed to this function are contained within this ShapePrimitive. */
|
|
3
|
+
abstract contains(x: number, y: number): boolean;
|
|
4
|
+
/** Checks whether the x and y coordinates passed to this function are contained within the stroke of this shape */
|
|
5
|
+
/** Creates a clone of this ShapePrimitive instance. */
|
|
6
|
+
abstract clone(): ShapePrimitive;
|
|
7
|
+
/** Copies the properties from another ShapePrimitive to this ShapePrimitive. */
|
|
8
|
+
abstract copyFrom(source: ShapePrimitive): void;
|
|
9
|
+
/** Copies the properties from this ShapePrimitive to another ShapePrimitive. */
|
|
10
|
+
abstract copyTo(destination: ShapePrimitive): void;
|
|
11
|
+
/** Returns the framing rectangle of the ShapePrimitive as a Rectangle object. */
|
|
12
|
+
/** The X coordinate of the shape */
|
|
13
|
+
abstract getX(): number;
|
|
14
|
+
/** The Y coordinate of the shape */
|
|
15
|
+
abstract getY(): number;
|
|
16
|
+
abstract build(points: number[]): void;
|
|
17
|
+
abstract triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
18
|
+
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { Matrix4 } from '@galacean/effects-math/es/core/index';
|
|
2
|
-
import type { vec2, vec4 } from '@galacean/effects-specification';
|
|
3
1
|
import * as spec from '@galacean/effects-specification';
|
|
4
|
-
import { RendererComponent } from '../../components/renderer-component';
|
|
5
2
|
import type { Engine } from '../../engine';
|
|
6
|
-
import {
|
|
7
|
-
import type { ValueGetter } from '../../math';
|
|
8
|
-
import type { Renderer } from '../../render';
|
|
3
|
+
import type { GeometryDrawMode } from '../../render';
|
|
9
4
|
import { Geometry } from '../../render';
|
|
10
5
|
import type { GeometryFromShape } from '../../shape';
|
|
11
6
|
import type { Texture } from '../../texture';
|
|
12
|
-
import type {
|
|
13
|
-
import {
|
|
14
|
-
import type {
|
|
7
|
+
import type { PlayableGraph, Playable } from '../cal/playable-graph';
|
|
8
|
+
import { PlayableAsset } from '../cal/playable-graph';
|
|
9
|
+
import type { ColorPlayableAssetData } from '../../animation';
|
|
10
|
+
import type { ItemRenderer } from '../../components';
|
|
11
|
+
import { BaseRenderComponent } from '../../components/base-render-component';
|
|
15
12
|
/**
|
|
16
13
|
* 用于创建 spriteItem 的数据类型, 经过处理后的 spec.SpriteContent
|
|
17
14
|
*/
|
|
@@ -27,123 +24,32 @@ export interface SpriteItemProps extends Omit<spec.SpriteContent, 'renderer'> {
|
|
|
27
24
|
* 图层元素基础属性, 经过处理后的 spec.SpriteContent.options
|
|
28
25
|
*/
|
|
29
26
|
export type SpriteItemOptions = {
|
|
30
|
-
startColor: vec4;
|
|
27
|
+
startColor: spec.vec4;
|
|
31
28
|
renderLevel?: spec.RenderLevel;
|
|
32
29
|
};
|
|
33
30
|
/**
|
|
34
31
|
* 图层元素渲染属性, 经过处理后的 spec.SpriteContent.renderer
|
|
35
32
|
*/
|
|
36
|
-
export interface SpriteItemRenderer extends
|
|
37
|
-
order: number;
|
|
38
|
-
mask: number;
|
|
39
|
-
texture: Texture;
|
|
33
|
+
export interface SpriteItemRenderer extends ItemRenderer {
|
|
40
34
|
shape?: GeometryFromShape;
|
|
41
|
-
anchor?: vec2;
|
|
42
|
-
particleOrigin?: spec.ParticleOrigin;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* 图层的渲染属性,用于 Mesh 的合并判断
|
|
46
|
-
*/
|
|
47
|
-
export interface SpriteItemRenderInfo {
|
|
48
|
-
side: number;
|
|
49
|
-
occlusion: boolean;
|
|
50
|
-
blending: number;
|
|
51
|
-
cachePrefix: string;
|
|
52
|
-
mask: number;
|
|
53
|
-
maskMode: number;
|
|
54
|
-
cacheId: string;
|
|
55
|
-
wireframe?: boolean;
|
|
56
35
|
}
|
|
57
36
|
export type splitsDataType = [r: number, x: number, y: number, w: number, h: number | undefined][];
|
|
58
|
-
export declare class SpriteColorPlayable extends Playable {
|
|
59
|
-
clipData: {
|
|
60
|
-
colorOverLifetime?: spec.ColorOverLifetime;
|
|
61
|
-
startColor?: spec.RGBAColorValue;
|
|
62
|
-
};
|
|
63
|
-
colorOverLifetime: {
|
|
64
|
-
stop: number;
|
|
65
|
-
color: any;
|
|
66
|
-
}[];
|
|
67
|
-
opacityOverLifetime: ValueGetter<number>;
|
|
68
|
-
startColor: spec.RGBAColorValue;
|
|
69
|
-
renderColor: vec4;
|
|
70
|
-
spriteMaterial: Material;
|
|
71
|
-
spriteComponent: SpriteComponent;
|
|
72
|
-
processFrame(context: FrameContext): void;
|
|
73
|
-
create(clipData: SpriteColorPlayableAssetData): this;
|
|
74
|
-
}
|
|
75
37
|
export declare class SpriteColorPlayableAsset extends PlayableAsset {
|
|
76
|
-
data:
|
|
38
|
+
data: ColorPlayableAssetData;
|
|
77
39
|
createPlayable(graph: PlayableGraph): Playable;
|
|
78
|
-
fromData(data:
|
|
79
|
-
}
|
|
80
|
-
export interface SpriteColorPlayableAssetData extends spec.EffectsObjectData {
|
|
81
|
-
colorOverLifetime?: spec.ColorOverLifetime;
|
|
40
|
+
fromData(data: ColorPlayableAssetData): void;
|
|
82
41
|
}
|
|
83
|
-
export declare class SpriteComponent extends
|
|
84
|
-
renderer: SpriteItemRenderer;
|
|
85
|
-
interaction?: {
|
|
86
|
-
behavior: spec.InteractBehavior;
|
|
87
|
-
};
|
|
88
|
-
cachePrefix: string;
|
|
89
|
-
geoData: {
|
|
90
|
-
atlasOffset: number[] | spec.TypedArray;
|
|
91
|
-
index: number[] | spec.TypedArray;
|
|
92
|
-
};
|
|
93
|
-
anchor?: vec2;
|
|
42
|
+
export declare class SpriteComponent extends BaseRenderComponent {
|
|
94
43
|
textureSheetAnimation?: spec.TextureSheetAnimation;
|
|
95
|
-
frameAnimationLoop: boolean;
|
|
96
44
|
splits: splitsDataType;
|
|
97
|
-
|
|
98
|
-
color: vec4;
|
|
99
|
-
worldMatrix: Matrix4;
|
|
100
|
-
geometry: Geometry;
|
|
101
|
-
/***********************/
|
|
102
|
-
private renderInfo;
|
|
103
|
-
private readonly wireframe?;
|
|
104
|
-
private preMultiAlpha;
|
|
105
|
-
private visible;
|
|
106
|
-
private isManualTimeSet;
|
|
107
|
-
private frameAnimationTime;
|
|
45
|
+
frameAnimationLoop: boolean;
|
|
108
46
|
constructor(engine: Engine, props?: SpriteItemProps);
|
|
109
|
-
/**
|
|
110
|
-
* 设置当前 Mesh 的可见性。
|
|
111
|
-
* @param visible - true:可见,false:不可见
|
|
112
|
-
*/
|
|
113
|
-
setVisible(visible: boolean): void;
|
|
114
|
-
/**
|
|
115
|
-
* 获取当前 Mesh 的可见性。
|
|
116
|
-
*/
|
|
117
|
-
getVisible(): boolean;
|
|
118
|
-
/**
|
|
119
|
-
* 设置当前图层的颜色
|
|
120
|
-
* > Tips: 透明度也属于颜色的一部分,当有透明度/颜色 K 帧变化时,该 API 会失效
|
|
121
|
-
* @since 2.0.0
|
|
122
|
-
* @param color - 颜色值
|
|
123
|
-
*/
|
|
124
|
-
setColor(color: vec4): void;
|
|
125
|
-
/**
|
|
126
|
-
* 设置当前 Mesh 的纹理
|
|
127
|
-
* @since 2.0.0
|
|
128
|
-
* @param texture - 纹理对象
|
|
129
|
-
*/
|
|
130
|
-
setTexture(texture: Texture): void;
|
|
131
|
-
render(renderer: Renderer): void;
|
|
132
|
-
onStart(): void;
|
|
133
47
|
onUpdate(dt: number): void;
|
|
134
48
|
onDestroy(): void;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
getTextures(): Texture[];
|
|
141
|
-
/**
|
|
142
|
-
* 获取图层包围盒的类型和世界坐标
|
|
143
|
-
* @returns
|
|
144
|
-
*/
|
|
145
|
-
getBoundingBox(): BoundingBoxTriangle | void;
|
|
146
|
-
getHitTestParams: (force?: boolean) => HitTestTriangleParams | void;
|
|
49
|
+
createGeometry(mode: GeometryDrawMode): Geometry;
|
|
50
|
+
getItemGeometryData(): {
|
|
51
|
+
index: number[];
|
|
52
|
+
atlasOffset: number[];
|
|
53
|
+
};
|
|
147
54
|
fromData(data: SpriteItemProps): void;
|
|
148
|
-
toData(): void;
|
|
149
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { PrecompileOptions } from '../../plugin-system';
|
|
3
3
|
import type { Renderer } from '../../render';
|
|
4
|
-
import { AbstractPlugin } from '../
|
|
4
|
+
import { AbstractPlugin } from '../plugin';
|
|
5
5
|
export declare class SpriteLoader extends AbstractPlugin {
|
|
6
6
|
name: string;
|
|
7
7
|
static precompile(compositions: spec.Composition[], render: Renderer, options?: PrecompileOptions): Promise<any>;
|
|
@@ -2,7 +2,7 @@ import type { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
|
2
2
|
import type * as spec from '@galacean/effects-specification';
|
|
3
3
|
import type { GPUCapabilityDetail, SharedShaderWithSource } from '../../render';
|
|
4
4
|
import type { Transform } from '../../transform';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ItemRenderInfo } from '../../components';
|
|
6
6
|
export type SpriteRenderData = {
|
|
7
7
|
life: number;
|
|
8
8
|
transform: Transform;
|
|
@@ -21,11 +21,10 @@ export type SpriteRegionData = {
|
|
|
21
21
|
};
|
|
22
22
|
export declare let maxSpriteMeshItemCount: number;
|
|
23
23
|
export declare function setSpriteMeshMaxItemCountByGPU(gpuCapability: GPUCapabilityDetail): 16 | 32 | undefined;
|
|
24
|
-
export declare function getImageItemRenderInfo(item: SpriteComponent): SpriteItemRenderInfo;
|
|
25
24
|
export declare function spriteMeshShaderFromFilter(level: number, options?: {
|
|
26
25
|
wireframe?: boolean;
|
|
27
26
|
env?: string;
|
|
28
27
|
}): SharedShaderWithSource;
|
|
29
|
-
export declare function spriteMeshShaderIdFromRenderInfo(renderInfo:
|
|
30
|
-
export declare function spriteMeshShaderFromRenderInfo(renderInfo:
|
|
28
|
+
export declare function spriteMeshShaderIdFromRenderInfo(renderInfo: ItemRenderInfo, count: number): string;
|
|
29
|
+
export declare function spriteMeshShaderFromRenderInfo(renderInfo: ItemRenderInfo, count: number, level: number, env?: string): SharedShaderWithSource;
|
|
31
30
|
export declare function setMaxSpriteMeshItemCount(count: number): void;
|