@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.
- package/dist/animation/color-playable.d.ts +26 -0
- package/dist/animation/index.d.ts +1 -0
- package/dist/asset-manager.d.ts +15 -7
- package/dist/asset.d.ts +4 -0
- package/dist/binary-asset.d.ts +2 -2
- package/dist/comp-vfx-item.d.ts +4 -7
- package/dist/components/base-render-component.d.ts +108 -0
- package/dist/components/effect-component.d.ts +3 -34
- package/dist/components/fake-3d-component.d.ts +28 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/mesh-component.d.ts +21 -0
- package/dist/components/post-process-volume.d.ts +10 -11
- package/dist/components/shape-component.d.ts +285 -0
- package/dist/composition/scene-ticking.d.ts +15 -1
- package/dist/composition-source-manager.d.ts +5 -6
- package/dist/composition.d.ts +34 -23
- package/dist/downloader.d.ts +0 -3
- package/dist/effects-object.d.ts +23 -0
- package/dist/engine.d.ts +9 -0
- package/dist/events/event-emitter.d.ts +6 -0
- package/dist/events/types.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +20858 -17794
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20852 -17790
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +4 -1
- package/dist/math/index.d.ts +1 -1
- package/dist/math/translate.d.ts +1 -1
- package/dist/math/value-getters/color-curve.d.ts +12 -0
- package/dist/math/value-getters/index.d.ts +4 -0
- package/dist/math/value-getters/value-getter-map.d.ts +2 -0
- package/dist/math/{value-getter.d.ts → value-getters/value-getter.d.ts} +6 -4
- package/dist/math/value-getters/vector4-curve.d.ts +12 -0
- package/dist/plugin-system.d.ts +7 -5
- package/dist/plugins/cal/calculate-item.d.ts +5 -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/cal/playable-graph.d.ts +4 -2
- package/dist/plugins/camera/camera-vfx-item-loader.d.ts +1 -1
- package/dist/plugins/index.d.ts +2 -7
- package/dist/plugins/interact/interact-item.d.ts +14 -1
- package/dist/plugins/interact/interact-loader.d.ts +1 -1
- package/dist/plugins/interact/mesh-collider.d.ts +15 -0
- package/dist/plugins/particle/burst.d.ts +2 -0
- package/dist/plugins/particle/particle-mesh.d.ts +8 -5
- package/dist/plugins/particle/particle-system.d.ts +3 -4
- package/dist/plugins/plugin.d.ts +14 -3
- package/dist/plugins/shape/build-adaptive-bezier.d.ts +1 -0
- package/dist/plugins/shape/ellipse.d.ts +79 -0
- package/dist/plugins/shape/graphics-path.d.ts +65 -0
- package/dist/plugins/shape/point-data.d.ts +6 -0
- package/dist/plugins/shape/point-like.d.ts +31 -0
- package/dist/plugins/shape/point.d.ts +58 -0
- package/dist/plugins/shape/poly-star.d.ts +42 -0
- package/dist/plugins/shape/polygon.d.ts +67 -0
- package/dist/plugins/shape/rectangle.d.ts +129 -0
- package/dist/plugins/shape/shape-path.d.ts +75 -0
- package/dist/plugins/shape/shape-primitive.d.ts +15 -0
- package/dist/plugins/shape/triangle.d.ts +89 -0
- package/dist/plugins/shape/triangulate.d.ts +1 -0
- package/dist/plugins/sprite/sprite-item.d.ts +15 -116
- 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/color-property-playable-asset.d.ts +7 -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 +9 -9
- package/dist/plugins/timeline/playable-assets/vector4-property-playable-asset.d.ts +7 -0
- package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +0 -2
- package/dist/plugins/timeline/playables/color-property-mixer-playable.d.ts +6 -0
- package/dist/plugins/timeline/playables/float-property-mixer-playable.d.ts +6 -0
- package/dist/plugins/timeline/playables/index.d.ts +7 -0
- package/dist/plugins/timeline/playables/property-clip-playable.d.ts +8 -0
- package/dist/plugins/timeline/playables/vector4-property-mixer-playable.d.ts +6 -0
- package/dist/plugins/timeline/track-instance.d.ts +14 -0
- package/dist/plugins/timeline/track.d.ts +6 -4
- package/dist/plugins/timeline/tracks/color-property-track.d.ts +5 -0
- package/dist/plugins/timeline/tracks/float-property-track.d.ts +6 -0
- package/dist/plugins/timeline/tracks/index.d.ts +9 -0
- package/dist/plugins/timeline/tracks/material-track.d.ts +5 -0
- package/dist/plugins/timeline/tracks/property-track.d.ts +8 -0
- package/dist/plugins/timeline/tracks/sub-composition-track.d.ts +1 -1
- package/dist/plugins/timeline/tracks/vector4-property-track.d.ts +5 -0
- package/dist/render/gpu-capability.d.ts +1 -1
- package/dist/render/index.d.ts +0 -1
- package/dist/render/mesh.d.ts +1 -1
- package/dist/render/render-frame.d.ts +5 -1
- package/dist/render/renderer.d.ts +1 -1
- package/dist/render/semantic-map.d.ts +1 -1
- package/dist/render/shader.d.ts +1 -1
- package/dist/scene.d.ts +17 -18
- package/dist/serialization-helper.d.ts +3 -3
- package/dist/shape/geometry.d.ts +4 -4
- package/dist/texture/texture.d.ts +11 -2
- package/dist/texture/utils.d.ts +1 -2
- package/dist/transform.d.ts +8 -0
- package/dist/utils/color.d.ts +4 -5
- package/dist/utils/index.d.ts +1 -1
- package/dist/vfx-item.d.ts +67 -31
- package/package.json +4 -3
- package/dist/image-asset.d.ts +0 -5
- package/dist/render/global-volume.d.ts +0 -17
- /package/dist/plugins/timeline/{playables → playable-assets}/sub-composition-playable-asset.d.ts +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ShapePrimitive } from './shape-primitive';
|
|
2
|
+
export declare enum StarType {
|
|
3
|
+
Star = 0,
|
|
4
|
+
Polygon = 1
|
|
5
|
+
}
|
|
6
|
+
export declare class PolyStar extends ShapePrimitive {
|
|
7
|
+
pointCount: number;
|
|
8
|
+
outerRadius: number;
|
|
9
|
+
innerRadius: number;
|
|
10
|
+
outerRoundness: number;
|
|
11
|
+
innerRoundness: number;
|
|
12
|
+
starType: StarType;
|
|
13
|
+
/**
|
|
14
|
+
* bezier 顶点
|
|
15
|
+
*/
|
|
16
|
+
private v;
|
|
17
|
+
/**
|
|
18
|
+
* bezier 缓入点
|
|
19
|
+
*/
|
|
20
|
+
private in;
|
|
21
|
+
/**
|
|
22
|
+
* bezier 缓出点
|
|
23
|
+
*/
|
|
24
|
+
private out;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param pointCount - 多边形顶点数量
|
|
28
|
+
* @param outerRadius - 外半径大小
|
|
29
|
+
* @param innerRadius - 内半径大小
|
|
30
|
+
* @param outerRoundness - 外顶点圆滑度百分比
|
|
31
|
+
* @param innerRoundness - 内顶点圆滑度百分比
|
|
32
|
+
* @param starType - PolyStar 类型
|
|
33
|
+
*/
|
|
34
|
+
constructor(pointCount?: number, outerRadius?: number, innerRadius?: number, outerRoundness?: number, innerRoundness?: number, starType?: StarType);
|
|
35
|
+
clone(): ShapePrimitive;
|
|
36
|
+
copyFrom(source: PolyStar): void;
|
|
37
|
+
copyTo(destination: PolyStar): void;
|
|
38
|
+
build(points: number[]): void;
|
|
39
|
+
triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
40
|
+
private buildStarPath;
|
|
41
|
+
private buildPolygonPath;
|
|
42
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on:
|
|
3
|
+
* https://github.com/pixijs/pixijs/blob/dev/src/maths/shapes/Polygon.ts
|
|
4
|
+
*/
|
|
5
|
+
import { ShapePrimitive } from './shape-primitive';
|
|
6
|
+
import type { PointData } from './point-data';
|
|
7
|
+
/**
|
|
8
|
+
* A class to define a shape via user defined coordinates.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Polygon extends ShapePrimitive {
|
|
11
|
+
/**
|
|
12
|
+
* An array of the points of this polygon.
|
|
13
|
+
*/
|
|
14
|
+
points: number[];
|
|
15
|
+
/**
|
|
16
|
+
* `false` after moveTo, `true` after `closePath`. In all other cases it is `true`.
|
|
17
|
+
*/
|
|
18
|
+
closePath: boolean;
|
|
19
|
+
constructor(points: PointData[] | number[]);
|
|
20
|
+
constructor(...points: PointData[] | number[]);
|
|
21
|
+
/**
|
|
22
|
+
* Creates a clone of this polygon.
|
|
23
|
+
* @returns - A copy of the polygon.
|
|
24
|
+
*/
|
|
25
|
+
clone(): Polygon;
|
|
26
|
+
/**
|
|
27
|
+
* Checks whether the x and y coordinates passed to this function are contained within this polygon.
|
|
28
|
+
* @param x - The X coordinate of the point to test.
|
|
29
|
+
* @param y - The Y coordinate of the point to test.
|
|
30
|
+
* @returns - Whether the x/y coordinates are within this polygon.
|
|
31
|
+
*/
|
|
32
|
+
contains(x: number, y: number): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Copies another polygon to this one.
|
|
35
|
+
* @param polygon - The polygon to copy from.
|
|
36
|
+
* @returns Returns itself.
|
|
37
|
+
*/
|
|
38
|
+
copyFrom(polygon: Polygon): this;
|
|
39
|
+
/**
|
|
40
|
+
* Copies this polygon to another one.
|
|
41
|
+
* @param polygon - The polygon to copy to.
|
|
42
|
+
* @returns Returns given parameter.
|
|
43
|
+
*/
|
|
44
|
+
copyTo(polygon: Polygon): Polygon;
|
|
45
|
+
/**
|
|
46
|
+
* Get the last X coordinate of the polygon
|
|
47
|
+
* @readonly
|
|
48
|
+
*/
|
|
49
|
+
get lastX(): number;
|
|
50
|
+
/**
|
|
51
|
+
* Get the last Y coordinate of the polygon
|
|
52
|
+
* @readonly
|
|
53
|
+
*/
|
|
54
|
+
get lastY(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Get the first X coordinate of the polygon
|
|
57
|
+
* @readonly
|
|
58
|
+
*/
|
|
59
|
+
getX(): number;
|
|
60
|
+
/**
|
|
61
|
+
* Get the first Y coordinate of the polygon
|
|
62
|
+
* @readonly
|
|
63
|
+
*/
|
|
64
|
+
getY(): number;
|
|
65
|
+
build(points: number[]): void;
|
|
66
|
+
triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { ShapePrimitive } from './shape-primitive';
|
|
2
|
+
/**
|
|
3
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its top-left corner
|
|
4
|
+
* point (`x`, `y`) and by its `width` and its `height`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Rectangle extends ShapePrimitive {
|
|
7
|
+
/**
|
|
8
|
+
* The X coordinate of the upper-left corner of the rectangle
|
|
9
|
+
* @default 0
|
|
10
|
+
*/
|
|
11
|
+
x: number;
|
|
12
|
+
/**
|
|
13
|
+
* The Y coordinate of the upper-left corner of the rectangle
|
|
14
|
+
* @default 0
|
|
15
|
+
*/
|
|
16
|
+
y: number;
|
|
17
|
+
/**
|
|
18
|
+
* The overall width of this rectangle
|
|
19
|
+
* @default 0
|
|
20
|
+
*/
|
|
21
|
+
width: number;
|
|
22
|
+
/**
|
|
23
|
+
* The overall height of this rectangle
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
|
+
height: number;
|
|
27
|
+
/**
|
|
28
|
+
* @param x - The X coordinate of the upper-left corner of the rectangle
|
|
29
|
+
* @param y - The Y coordinate of the upper-left corner of the rectangle
|
|
30
|
+
* @param width - The overall width of the rectangle
|
|
31
|
+
* @param height - The overall height of the rectangle
|
|
32
|
+
*/
|
|
33
|
+
constructor(x?: string | number, y?: string | number, width?: string | number, height?: string | number);
|
|
34
|
+
/** Returns the left edge of the rectangle. */
|
|
35
|
+
get left(): number;
|
|
36
|
+
/** Returns the right edge of the rectangle. */
|
|
37
|
+
get right(): number;
|
|
38
|
+
/** Returns the top edge of the rectangle. */
|
|
39
|
+
get top(): number;
|
|
40
|
+
/** Returns the bottom edge of the rectangle. */
|
|
41
|
+
get bottom(): number;
|
|
42
|
+
/** Determines whether the Rectangle is empty. */
|
|
43
|
+
isEmpty(): boolean;
|
|
44
|
+
/** A constant empty rectangle. This is a new object every time the property is accessed */
|
|
45
|
+
static get EMPTY(): Rectangle;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a clone of this Rectangle
|
|
48
|
+
* @returns a copy of the rectangle
|
|
49
|
+
*/
|
|
50
|
+
clone(): Rectangle;
|
|
51
|
+
/**
|
|
52
|
+
* Converts a Bounds object to a Rectangle object.
|
|
53
|
+
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
54
|
+
* @returns Returns itself.
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* Copies another rectangle to this one.
|
|
58
|
+
* @param rectangle - The rectangle to copy from.
|
|
59
|
+
* @returns Returns itself.
|
|
60
|
+
*/
|
|
61
|
+
copyFrom(rectangle: Rectangle): Rectangle;
|
|
62
|
+
/**
|
|
63
|
+
* Copies this rectangle to another one.
|
|
64
|
+
* @param rectangle - The rectangle to copy to.
|
|
65
|
+
* @returns Returns given parameter.
|
|
66
|
+
*/
|
|
67
|
+
copyTo(rectangle: Rectangle): Rectangle;
|
|
68
|
+
/**
|
|
69
|
+
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
70
|
+
* @param x - The X coordinate of the point to test
|
|
71
|
+
* @param y - The Y coordinate of the point to test
|
|
72
|
+
* @returns Whether the x/y coordinates are within this Rectangle
|
|
73
|
+
*/
|
|
74
|
+
contains(x: number, y: number): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
77
|
+
* @param x - The X coordinate of the point to test
|
|
78
|
+
* @param y - The Y coordinate of the point to test
|
|
79
|
+
* @param strokeWidth - The width of the line to check
|
|
80
|
+
* @returns Whether the x/y coordinates are within this rectangle
|
|
81
|
+
*/
|
|
82
|
+
strokeContains(x: number, y: number, strokeWidth: number): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
85
|
+
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
86
|
+
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
87
|
+
* (width or height equal to zero) can't intersect any other rectangle.
|
|
88
|
+
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
89
|
+
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
90
|
+
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
91
|
+
*/
|
|
92
|
+
/**
|
|
93
|
+
* Pads the rectangle making it grow in all directions.
|
|
94
|
+
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
95
|
+
* @param paddingX - The horizontal padding amount.
|
|
96
|
+
* @param paddingY - The vertical padding amount.
|
|
97
|
+
* @returns Returns itself.
|
|
98
|
+
*/
|
|
99
|
+
pad(paddingX?: number, paddingY?: number): this;
|
|
100
|
+
/**
|
|
101
|
+
* Fits this rectangle around the passed one.
|
|
102
|
+
* @param rectangle - The rectangle to fit.
|
|
103
|
+
* @returns Returns itself.
|
|
104
|
+
*/
|
|
105
|
+
fit(rectangle: Rectangle): this;
|
|
106
|
+
/**
|
|
107
|
+
* Enlarges rectangle that way its corners lie on grid
|
|
108
|
+
* @param resolution - resolution
|
|
109
|
+
* @param eps - precision
|
|
110
|
+
* @returns Returns itself.
|
|
111
|
+
*/
|
|
112
|
+
ceil(resolution?: number, eps?: number): this;
|
|
113
|
+
/**
|
|
114
|
+
* Enlarges this rectangle to include the passed rectangle.
|
|
115
|
+
* @param rectangle - The rectangle to include.
|
|
116
|
+
* @returns Returns itself.
|
|
117
|
+
*/
|
|
118
|
+
enlarge(rectangle: Rectangle): this;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
121
|
+
* @param out - optional rectangle to store the result
|
|
122
|
+
* @returns The framing rectangle
|
|
123
|
+
*/
|
|
124
|
+
getBounds(out?: Rectangle): Rectangle;
|
|
125
|
+
getX(): number;
|
|
126
|
+
getY(): number;
|
|
127
|
+
build(points: number[]): number[];
|
|
128
|
+
triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
129
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on:
|
|
3
|
+
* https://github.com/pixijs/pixijs/blob/dev/src/scene/graphics/shared/path/ShapePath.ts
|
|
4
|
+
*/
|
|
5
|
+
import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
|
|
6
|
+
import { Polygon } from './polygon';
|
|
7
|
+
import type { GraphicsPath } from './graphics-path';
|
|
8
|
+
import type { ShapePrimitive } from './shape-primitive';
|
|
9
|
+
import type { StarType } from './poly-star';
|
|
10
|
+
export declare class ShapePath {
|
|
11
|
+
private graphicsPath;
|
|
12
|
+
currentPoly: Polygon | null;
|
|
13
|
+
shapePrimitives: {
|
|
14
|
+
shape: ShapePrimitive;
|
|
15
|
+
transform?: Matrix4;
|
|
16
|
+
}[];
|
|
17
|
+
constructor(graphicsPath: GraphicsPath);
|
|
18
|
+
/** Builds the path. */
|
|
19
|
+
buildPath(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Adds a cubic Bezier curve to the path.
|
|
22
|
+
* It requires three points: the first two are control points and the third one is the end point.
|
|
23
|
+
* The starting point is the last point in the current path.
|
|
24
|
+
* @param cp1x - The x-coordinate of the first control point.
|
|
25
|
+
* @param cp1y - The y-coordinate of the first control point.
|
|
26
|
+
* @param cp2x - The x-coordinate of the second control point.
|
|
27
|
+
* @param cp2y - The y-coordinate of the second control point.
|
|
28
|
+
* @param x - The x-coordinate of the end point.
|
|
29
|
+
* @param y - The y-coordinate of the end point.
|
|
30
|
+
* @param smoothness - Optional parameter to adjust the smoothness of the curve.
|
|
31
|
+
* @returns The instance of the current object for chaining.
|
|
32
|
+
*/
|
|
33
|
+
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): ShapePath;
|
|
34
|
+
moveTo(x: number, y: number): ShapePath;
|
|
35
|
+
/**
|
|
36
|
+
* Draws an ellipse at the specified location and with the given x and y radii.
|
|
37
|
+
* An optional transformation can be applied, allowing for rotation, scaling, and translation.
|
|
38
|
+
* @param x - The x-coordinate of the center of the ellipse.
|
|
39
|
+
* @param y - The y-coordinate of the center of the ellipse.
|
|
40
|
+
* @param radiusX - The horizontal radius of the ellipse.
|
|
41
|
+
* @param radiusY - The vertical radius of the ellipse.
|
|
42
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the ellipse. This can include rotations.
|
|
43
|
+
* @returns The instance of the current object for chaining.
|
|
44
|
+
*/
|
|
45
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, transform?: Matrix4): this;
|
|
46
|
+
polyStar(pointCount: number, outerRadius: number, innerRadius: number, outerRoundness: number, innerRoundness: number, starType: StarType, transform?: Matrix4): this;
|
|
47
|
+
/**
|
|
48
|
+
* Draws a given shape on the canvas.
|
|
49
|
+
* This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
|
|
50
|
+
* An optional transformation matrix can be applied to the shape, allowing for complex transformations.
|
|
51
|
+
* @param shape - The shape to draw, defined as a `ShapePrimitive` object.
|
|
52
|
+
* @param matrix - An optional `Matrix` for transforming the shape. This can include rotations,
|
|
53
|
+
* scaling, and translations.
|
|
54
|
+
* @returns The instance of the current object for chaining.
|
|
55
|
+
*/
|
|
56
|
+
drawShape(shape: ShapePrimitive, matrix?: Matrix4): this;
|
|
57
|
+
/**
|
|
58
|
+
* Starts a new polygon path from the specified starting point.
|
|
59
|
+
* This method initializes a new polygon or ends the current one if it exists.
|
|
60
|
+
* @param x - The x-coordinate of the starting point of the new polygon.
|
|
61
|
+
* @param y - The y-coordinate of the starting point of the new polygon.
|
|
62
|
+
* @returns The instance of the current object for chaining.
|
|
63
|
+
*/
|
|
64
|
+
private startPoly;
|
|
65
|
+
/**
|
|
66
|
+
* Ends the current polygon path. If `closePath` is set to true,
|
|
67
|
+
* the path is closed by connecting the last point to the first one.
|
|
68
|
+
* This method finalizes the current polygon and prepares it for drawing or adding to the shape primitives.
|
|
69
|
+
* @param closePath - A boolean indicating whether to close the polygon by connecting the last point
|
|
70
|
+
* back to the starting point. False by default.
|
|
71
|
+
* @returns The instance of the current object for chaining.
|
|
72
|
+
*/
|
|
73
|
+
private endPoly;
|
|
74
|
+
private ensurePoly;
|
|
75
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare abstract class ShapePrimitive {
|
|
2
|
+
/** Checks whether the x and y coordinates passed to this function are contained within this ShapePrimitive. */
|
|
3
|
+
/** Checks whether the x and y coordinates passed to this function are contained within the stroke of this shape */
|
|
4
|
+
/** Creates a clone of this ShapePrimitive instance. */
|
|
5
|
+
abstract clone(): ShapePrimitive;
|
|
6
|
+
/** Copies the properties from another ShapePrimitive to this ShapePrimitive. */
|
|
7
|
+
abstract copyFrom(source: ShapePrimitive): void;
|
|
8
|
+
/** Copies the properties from this ShapePrimitive to another ShapePrimitive. */
|
|
9
|
+
abstract copyTo(destination: ShapePrimitive): void;
|
|
10
|
+
/** Returns the framing rectangle of the ShapePrimitive as a Rectangle object. */
|
|
11
|
+
/** The X coordinate of the shape */
|
|
12
|
+
/** The Y coordinate of the shape */
|
|
13
|
+
abstract build(points: number[]): void;
|
|
14
|
+
abstract triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Rectangle } from './rectangle';
|
|
2
|
+
import { ShapePrimitive } from './shape-primitive';
|
|
3
|
+
/**
|
|
4
|
+
* A class to define a shape of a triangle via user defined coordinates.
|
|
5
|
+
*
|
|
6
|
+
* Create a `Triangle` object with the `x`, `y`, `x2`, `y2`, `x3`, `y3` properties.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Triangle extends ShapePrimitive {
|
|
9
|
+
/**
|
|
10
|
+
* The X coord of the first point.
|
|
11
|
+
* @default 0
|
|
12
|
+
*/
|
|
13
|
+
x: number;
|
|
14
|
+
/**
|
|
15
|
+
* The Y coord of the first point.
|
|
16
|
+
* @default 0
|
|
17
|
+
*/
|
|
18
|
+
y: number;
|
|
19
|
+
/**
|
|
20
|
+
* The X coord of the second point.
|
|
21
|
+
* @default 0
|
|
22
|
+
*/
|
|
23
|
+
x2: number;
|
|
24
|
+
/**
|
|
25
|
+
* The Y coord of the second point.
|
|
26
|
+
* @default 0
|
|
27
|
+
*/
|
|
28
|
+
y2: number;
|
|
29
|
+
/**
|
|
30
|
+
* The X coord of the third point.
|
|
31
|
+
* @default 0
|
|
32
|
+
*/
|
|
33
|
+
x3: number;
|
|
34
|
+
/**
|
|
35
|
+
* The Y coord of the third point.
|
|
36
|
+
* @default 0
|
|
37
|
+
*/
|
|
38
|
+
y3: number;
|
|
39
|
+
/**
|
|
40
|
+
* @param x - The X coord of the first point.
|
|
41
|
+
* @param y - The Y coord of the first point.
|
|
42
|
+
* @param x2 - The X coord of the second point.
|
|
43
|
+
* @param y2 - The Y coord of the second point.
|
|
44
|
+
* @param x3 - The X coord of the third point.
|
|
45
|
+
* @param y3 - The Y coord of the third point.
|
|
46
|
+
*/
|
|
47
|
+
constructor(x?: number, y?: number, x2?: number, y2?: number, x3?: number, y3?: number);
|
|
48
|
+
/**
|
|
49
|
+
* Checks whether the x and y coordinates given are contained within this triangle
|
|
50
|
+
* @param x - The X coordinate of the point to test
|
|
51
|
+
* @param y - The Y coordinate of the point to test
|
|
52
|
+
* @returns Whether the x/y coordinates are within this Triangle
|
|
53
|
+
*/
|
|
54
|
+
contains(x: number, y: number): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Checks whether the x and y coordinates given are contained within this triangle including the stroke.
|
|
57
|
+
* @param pointX - The X coordinate of the point to test
|
|
58
|
+
* @param pointY - The Y coordinate of the point to test
|
|
59
|
+
* @param strokeWidth - The width of the line to check
|
|
60
|
+
* @returns Whether the x/y coordinates are within this triangle
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* Creates a clone of this Triangle
|
|
64
|
+
* @returns a copy of the triangle
|
|
65
|
+
*/
|
|
66
|
+
clone(): ShapePrimitive;
|
|
67
|
+
/**
|
|
68
|
+
* Copies another triangle to this one.
|
|
69
|
+
* @param triangle - The triangle to copy from.
|
|
70
|
+
* @returns Returns itself.
|
|
71
|
+
*/
|
|
72
|
+
copyFrom(triangle: Triangle): this;
|
|
73
|
+
/**
|
|
74
|
+
* Copies this triangle to another one.
|
|
75
|
+
* @param triangle - The triangle to copy to.
|
|
76
|
+
* @returns Returns given parameter.
|
|
77
|
+
*/
|
|
78
|
+
copyTo(triangle: Triangle): Triangle;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the framing rectangle of the triangle as a Rectangle object
|
|
81
|
+
* @param out - optional rectangle to store the result
|
|
82
|
+
* @returns The framing rectangle
|
|
83
|
+
*/
|
|
84
|
+
getBounds(out?: Rectangle): Rectangle;
|
|
85
|
+
getX(): number;
|
|
86
|
+
getY(): number;
|
|
87
|
+
build(points: number[]): void;
|
|
88
|
+
triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function triangulate(contours: number[][]): number[];
|
|
@@ -1,17 +1,13 @@
|
|
|
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 { BaseRenderComponent } from '../../components/base-render-component';
|
|
15
11
|
/**
|
|
16
12
|
* 用于创建 spriteItem 的数据类型, 经过处理后的 spec.SpriteContent
|
|
17
13
|
*/
|
|
@@ -27,123 +23,26 @@ export interface SpriteItemProps extends Omit<spec.SpriteContent, 'renderer'> {
|
|
|
27
23
|
* 图层元素基础属性, 经过处理后的 spec.SpriteContent.options
|
|
28
24
|
*/
|
|
29
25
|
export type SpriteItemOptions = {
|
|
30
|
-
startColor: vec4;
|
|
26
|
+
startColor: spec.vec4;
|
|
31
27
|
renderLevel?: spec.RenderLevel;
|
|
32
28
|
};
|
|
33
|
-
/**
|
|
34
|
-
* 图层元素渲染属性, 经过处理后的 spec.SpriteContent.renderer
|
|
35
|
-
*/
|
|
36
|
-
export interface SpriteItemRenderer extends Required<Omit<spec.RendererOptions, 'texture' | 'shape' | 'anchor' | 'particleOrigin'>> {
|
|
37
|
-
order: number;
|
|
38
|
-
mask: number;
|
|
39
|
-
texture: Texture;
|
|
40
|
-
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
|
-
}
|
|
57
29
|
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
30
|
export declare class SpriteColorPlayableAsset extends PlayableAsset {
|
|
76
|
-
data:
|
|
31
|
+
data: ColorPlayableAssetData;
|
|
77
32
|
createPlayable(graph: PlayableGraph): Playable;
|
|
78
|
-
fromData(data:
|
|
79
|
-
}
|
|
80
|
-
export interface SpriteColorPlayableAssetData extends spec.EffectsObjectData {
|
|
81
|
-
colorOverLifetime?: spec.ColorOverLifetime;
|
|
33
|
+
fromData(data: ColorPlayableAssetData): void;
|
|
82
34
|
}
|
|
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;
|
|
35
|
+
export declare class SpriteComponent extends BaseRenderComponent {
|
|
94
36
|
textureSheetAnimation?: spec.TextureSheetAnimation;
|
|
95
|
-
frameAnimationLoop: boolean;
|
|
96
37
|
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;
|
|
38
|
+
frameAnimationLoop: boolean;
|
|
108
39
|
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
40
|
onUpdate(dt: number): void;
|
|
134
41
|
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;
|
|
42
|
+
createGeometry(mode: GeometryDrawMode): Geometry;
|
|
43
|
+
getItemGeometryData(): {
|
|
44
|
+
index: number[];
|
|
45
|
+
atlasOffset: number[];
|
|
46
|
+
};
|
|
147
47
|
fromData(data: SpriteItemProps): void;
|
|
148
|
-
toData(): void;
|
|
149
48
|
}
|
|
@@ -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;
|
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
import * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { Engine } from '../../engine';
|
|
3
|
-
import
|
|
4
|
-
import { SpriteComponent } from '../sprite/sprite-item';
|
|
3
|
+
import { Texture } from '../../texture';
|
|
5
4
|
import { TextLayout } from './text-layout';
|
|
6
5
|
import { TextStyle } from './text-style';
|
|
7
6
|
import type { Material } from '../../material';
|
|
8
7
|
import type { VFXItem } from '../../vfx-item';
|
|
8
|
+
import { BaseRenderComponent } from '../../components';
|
|
9
|
+
/**
|
|
10
|
+
* 用于创建 textItem 的数据类型, 经过处理后的 spec.TextContentOptions
|
|
11
|
+
*/
|
|
12
|
+
export interface TextItemProps extends Omit<spec.TextContent, 'renderer'> {
|
|
13
|
+
listIndex?: number;
|
|
14
|
+
renderer: {
|
|
15
|
+
mask: number;
|
|
16
|
+
texture: Texture;
|
|
17
|
+
} & Omit<spec.RendererOptions, 'texture'>;
|
|
18
|
+
}
|
|
9
19
|
export declare const DEFAULT_FONTS: string[];
|
|
10
20
|
export interface TextComponent extends TextComponentBase {
|
|
11
21
|
}
|
|
12
22
|
/**
|
|
13
23
|
* @since 2.0.0
|
|
14
24
|
*/
|
|
15
|
-
export declare class TextComponent extends
|
|
25
|
+
export declare class TextComponent extends BaseRenderComponent {
|
|
16
26
|
isDirty: boolean;
|
|
17
27
|
/**
|
|
18
28
|
* 文本行数
|
|
19
29
|
*/
|
|
20
30
|
lineCount: number;
|
|
21
|
-
constructor(engine: Engine, props?:
|
|
31
|
+
constructor(engine: Engine, props?: TextItemProps);
|
|
22
32
|
onUpdate(dt: number): void;
|
|
23
|
-
fromData(data:
|
|
33
|
+
fromData(data: TextItemProps): void;
|
|
24
34
|
updateWithOptions(options: spec.TextContentOptions): void;
|
|
25
35
|
updateTexture(flipY?: boolean): void;
|
|
26
36
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Playable, PlayableGraph } from '../../cal/playable-graph';
|
|
2
|
+
import { PlayableAsset } from '../../cal/playable-graph';
|
|
3
|
+
import * as spec from '@galacean/effects-specification';
|
|
4
|
+
export declare class ColorPropertyPlayableAsset extends PlayableAsset {
|
|
5
|
+
curveData: spec.ColorCurveData;
|
|
6
|
+
createPlayable(graph: PlayableGraph): Playable;
|
|
7
|
+
}
|