@galacean/effects-core 2.1.0-alpha.5 → 2.1.0-alpha.6
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/asset-manager.d.ts +7 -6
- package/dist/binary-asset.d.ts +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/shape-component.d.ts +172 -0
- package/dist/composition-source-manager.d.ts +1 -1
- package/dist/composition.d.ts +10 -4
- package/dist/image-asset.d.ts +2 -2
- package/dist/index.js +1824 -226
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1825 -224
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/cal/timeline-asset.d.ts +1 -1
- package/dist/plugins/shape/build-adaptive-bezier.d.ts +1 -0
- package/dist/plugins/shape/graphics-path.d.ts +35 -0
- package/dist/plugins/shape/point-data.d.ts +6 -0
- package/dist/plugins/shape/polygon.d.ts +60 -0
- package/dist/plugins/shape/shape-path.d.ts +51 -0
- package/dist/plugins/shape/triangulate.d.ts +1 -0
- package/dist/plugins/timeline/track.d.ts +2 -2
- package/dist/render/gpu-capability.d.ts +1 -1
- package/dist/render/shader.d.ts +1 -1
- package/dist/scene.d.ts +17 -18
- package/dist/shape/geometry.d.ts +3 -3
- package/dist/texture/utils.d.ts +1 -2
- package/package.json +4 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { RuntimeClip, TrackAsset } from '../timeline/track';
|
|
3
3
|
import type { FrameContext, PlayableGraph } from './playable-graph';
|
|
4
4
|
import { Playable, PlayableAsset } from './playable-graph';
|
|
@@ -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,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on:
|
|
3
|
+
* https://github.com/pixijs/pixijs/blob/dev/src/scene/graphics/shared/path/GraphicsPath.ts
|
|
4
|
+
*/
|
|
5
|
+
import { ShapePath } from './shape-path';
|
|
6
|
+
export declare class GraphicsPath {
|
|
7
|
+
instructions: PathInstruction[];
|
|
8
|
+
private dirty;
|
|
9
|
+
private _shapePath;
|
|
10
|
+
/**
|
|
11
|
+
* Provides access to the internal shape path, ensuring it is up-to-date with the current instructions.
|
|
12
|
+
* @returns The `ShapePath` instance associated with this `GraphicsPath`.
|
|
13
|
+
*/
|
|
14
|
+
get shapePath(): ShapePath;
|
|
15
|
+
/**
|
|
16
|
+
* Adds a cubic Bezier curve to the path.
|
|
17
|
+
* It requires three points: the first two are control points and the third one is the end point.
|
|
18
|
+
* The starting point is the last point in the current path.
|
|
19
|
+
* @param cp1x - The x-coordinate of the first control point.
|
|
20
|
+
* @param cp1y - The y-coordinate of the first control point.
|
|
21
|
+
* @param cp2x - The x-coordinate of the second control point.
|
|
22
|
+
* @param cp2y - The y-coordinate of the second control point.
|
|
23
|
+
* @param x - The x-coordinate of the end point.
|
|
24
|
+
* @param y - The y-coordinate of the end point.
|
|
25
|
+
* @param smoothness - Optional parameter to adjust the smoothness of the curve.
|
|
26
|
+
* @returns The instance of the current object for chaining.
|
|
27
|
+
*/
|
|
28
|
+
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): GraphicsPath;
|
|
29
|
+
moveTo(x: number, y: number): GraphicsPath;
|
|
30
|
+
clear(): GraphicsPath;
|
|
31
|
+
}
|
|
32
|
+
export interface PathInstruction {
|
|
33
|
+
action: 'moveTo' | 'lineTo' | 'quadraticCurveTo' | 'bezierCurveTo' | 'arc' | 'closePath' | 'addPath' | 'arcTo' | 'ellipse' | 'rect' | 'roundRect' | 'arcToSvg' | 'poly' | 'circle' | 'regularPoly' | 'roundPoly' | 'roundShape' | 'filletRect' | 'chamferRect';
|
|
34
|
+
data: any[];
|
|
35
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on:
|
|
3
|
+
* https://github.com/pixijs/pixijs/blob/dev/src/maths/shapes/Polygon.ts
|
|
4
|
+
*/
|
|
5
|
+
import type { PointData } from './point-data';
|
|
6
|
+
/**
|
|
7
|
+
* A class to define a shape via user defined coordinates.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Polygon {
|
|
10
|
+
/** An array of the points of this polygon. */
|
|
11
|
+
points: number[];
|
|
12
|
+
/** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */
|
|
13
|
+
closePath: boolean;
|
|
14
|
+
constructor(points: PointData[] | number[]);
|
|
15
|
+
constructor(...points: PointData[] | number[]);
|
|
16
|
+
/**
|
|
17
|
+
* Creates a clone of this polygon.
|
|
18
|
+
* @returns - A copy of the polygon.
|
|
19
|
+
*/
|
|
20
|
+
clone(): Polygon;
|
|
21
|
+
/**
|
|
22
|
+
* Checks whether the x and y coordinates passed to this function are contained within this polygon.
|
|
23
|
+
* @param x - The X coordinate of the point to test.
|
|
24
|
+
* @param y - The Y coordinate of the point to test.
|
|
25
|
+
* @returns - Whether the x/y coordinates are within this polygon.
|
|
26
|
+
*/
|
|
27
|
+
contains(x: number, y: number): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Copies another polygon to this one.
|
|
30
|
+
* @param polygon - The polygon to copy from.
|
|
31
|
+
* @returns Returns itself.
|
|
32
|
+
*/
|
|
33
|
+
copyFrom(polygon: Polygon): this;
|
|
34
|
+
/**
|
|
35
|
+
* Copies this polygon to another one.
|
|
36
|
+
* @param polygon - The polygon to copy to.
|
|
37
|
+
* @returns Returns given parameter.
|
|
38
|
+
*/
|
|
39
|
+
copyTo(polygon: Polygon): Polygon;
|
|
40
|
+
/**
|
|
41
|
+
* Get the last X coordinate of the polygon
|
|
42
|
+
* @readonly
|
|
43
|
+
*/
|
|
44
|
+
get lastX(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Get the last Y coordinate of the polygon
|
|
47
|
+
* @readonly
|
|
48
|
+
*/
|
|
49
|
+
get lastY(): number;
|
|
50
|
+
/**
|
|
51
|
+
* Get the first X coordinate of the polygon
|
|
52
|
+
* @readonly
|
|
53
|
+
*/
|
|
54
|
+
get x(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Get the first Y coordinate of the polygon
|
|
57
|
+
* @readonly
|
|
58
|
+
*/
|
|
59
|
+
get y(): number;
|
|
60
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on:
|
|
3
|
+
* https://github.com/pixijs/pixijs/blob/dev/src/scene/graphics/shared/path/ShapePath.ts
|
|
4
|
+
*/
|
|
5
|
+
import type { Matrix3 } from '@galacean/effects-math/es/core/matrix3';
|
|
6
|
+
import { Polygon } from './polygon';
|
|
7
|
+
import type { GraphicsPath } from './graphics-path';
|
|
8
|
+
export declare class ShapePath {
|
|
9
|
+
private graphicsPath;
|
|
10
|
+
currentPoly: Polygon | null;
|
|
11
|
+
shapePrimitives: {
|
|
12
|
+
shape: Polygon;
|
|
13
|
+
transform?: Matrix3;
|
|
14
|
+
}[];
|
|
15
|
+
constructor(graphicsPath: GraphicsPath);
|
|
16
|
+
/** Builds the path. */
|
|
17
|
+
buildPath(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Adds a cubic Bezier curve to the path.
|
|
20
|
+
* It requires three points: the first two are control points and the third one is the end point.
|
|
21
|
+
* The starting point is the last point in the current path.
|
|
22
|
+
* @param cp1x - The x-coordinate of the first control point.
|
|
23
|
+
* @param cp1y - The y-coordinate of the first control point.
|
|
24
|
+
* @param cp2x - The x-coordinate of the second control point.
|
|
25
|
+
* @param cp2y - The y-coordinate of the second control point.
|
|
26
|
+
* @param x - The x-coordinate of the end point.
|
|
27
|
+
* @param y - The y-coordinate of the end point.
|
|
28
|
+
* @param smoothness - Optional parameter to adjust the smoothness of the curve.
|
|
29
|
+
* @returns The instance of the current object for chaining.
|
|
30
|
+
*/
|
|
31
|
+
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): ShapePath;
|
|
32
|
+
moveTo(x: number, y: number): ShapePath;
|
|
33
|
+
/**
|
|
34
|
+
* Starts a new polygon path from the specified starting point.
|
|
35
|
+
* This method initializes a new polygon or ends the current one if it exists.
|
|
36
|
+
* @param x - The x-coordinate of the starting point of the new polygon.
|
|
37
|
+
* @param y - The y-coordinate of the starting point of the new polygon.
|
|
38
|
+
* @returns The instance of the current object for chaining.
|
|
39
|
+
*/
|
|
40
|
+
private startPoly;
|
|
41
|
+
/**
|
|
42
|
+
* Ends the current polygon path. If `closePath` is set to true,
|
|
43
|
+
* the path is closed by connecting the last point to the first one.
|
|
44
|
+
* This method finalizes the current polygon and prepares it for drawing or adding to the shape primitives.
|
|
45
|
+
* @param closePath - A boolean indicating whether to close the polygon by connecting the last point
|
|
46
|
+
* back to the starting point. False by default.
|
|
47
|
+
* @returns The instance of the current object for chaining.
|
|
48
|
+
*/
|
|
49
|
+
private endPoly;
|
|
50
|
+
private ensurePoly;
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function triangulate(contours: number[][]): number[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { PlayableGraph } from '../cal/playable-graph';
|
|
3
3
|
import { Playable, PlayableAsset, PlayableOutput } from '../cal/playable-graph';
|
|
4
4
|
import { ParticleSystem } from '../particle/particle-system';
|
|
@@ -12,7 +12,7 @@ export declare class TimelineClip {
|
|
|
12
12
|
start: number;
|
|
13
13
|
duration: number;
|
|
14
14
|
asset: PlayableAsset;
|
|
15
|
-
endBehavior: EndBehavior;
|
|
15
|
+
endBehavior: spec.EndBehavior;
|
|
16
16
|
constructor();
|
|
17
17
|
toLocalTime(time: number): number;
|
|
18
18
|
}
|
|
@@ -16,7 +16,7 @@ export interface GPUCapabilityDetail {
|
|
|
16
16
|
shaderTextureLod: boolean;
|
|
17
17
|
instanceDraw?: boolean;
|
|
18
18
|
drawBuffers?: boolean;
|
|
19
|
-
asyncShaderCompile
|
|
19
|
+
asyncShaderCompile: boolean;
|
|
20
20
|
intIndexElementBuffer?: boolean;
|
|
21
21
|
readableDepthStencilTextures?: boolean;
|
|
22
22
|
writableFragDepth?: boolean;
|
package/dist/render/shader.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as spec from '@galacean/effects-specification';
|
|
2
2
|
import { EffectsObject } from '../effects-object';
|
|
3
3
|
import type { Engine } from '../engine';
|
|
4
4
|
export type ShaderMacros = [key: string, value: string | number | boolean][];
|
package/dist/scene.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type * as spec from '@galacean/effects-specification';
|
|
|
2
2
|
import type { Texture } from './texture';
|
|
3
3
|
import type { PluginSystem } from './plugin-system';
|
|
4
4
|
import type { PickEnum } from './utils';
|
|
5
|
-
export type
|
|
5
|
+
export type ImageLike = spec.HTMLImageLike | ArrayBuffer | Texture;
|
|
6
6
|
export type SceneRenderLevel = PickEnum<spec.RenderLevel, spec.RenderLevel.A | spec.RenderLevel.B | spec.RenderLevel.S>;
|
|
7
7
|
/**
|
|
8
8
|
* 场景类型
|
|
@@ -14,7 +14,7 @@ export interface Scene {
|
|
|
14
14
|
readonly renderLevel?: SceneRenderLevel;
|
|
15
15
|
readonly storage: Record<string, any>;
|
|
16
16
|
textureOptions: Record<string, any>[];
|
|
17
|
-
images:
|
|
17
|
+
images: ImageLike[];
|
|
18
18
|
consumed?: boolean;
|
|
19
19
|
textures?: Texture[];
|
|
20
20
|
/**
|
|
@@ -29,8 +29,21 @@ export interface Scene {
|
|
|
29
29
|
* 加载分段时长
|
|
30
30
|
*/
|
|
31
31
|
timeInfos: Record<string, number>;
|
|
32
|
-
url:
|
|
33
|
-
|
|
32
|
+
url: Scene.LoadType;
|
|
33
|
+
}
|
|
34
|
+
export declare namespace Scene {
|
|
35
|
+
type URLType = {
|
|
36
|
+
url: string;
|
|
37
|
+
options?: SceneLoadOptions;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* 接受用于加载的数据类型
|
|
41
|
+
*/
|
|
42
|
+
export type LoadType = string | Scene | URLType | spec.JSONScene | Record<string, unknown>;
|
|
43
|
+
export function isJSONObject(scene: any): scene is Scene;
|
|
44
|
+
export function isURL(scene: any): scene is URLType;
|
|
45
|
+
export function isWithOptions(scene: any): scene is URLType;
|
|
46
|
+
export {};
|
|
34
47
|
}
|
|
35
48
|
/**
|
|
36
49
|
* 场景加载参数
|
|
@@ -96,17 +109,3 @@ export interface SceneLoadOptions {
|
|
|
96
109
|
*/
|
|
97
110
|
speed?: number;
|
|
98
111
|
}
|
|
99
|
-
/**
|
|
100
|
-
* 接受用于加载的数据类型
|
|
101
|
-
*/
|
|
102
|
-
export type SceneURLType = {
|
|
103
|
-
url: string;
|
|
104
|
-
};
|
|
105
|
-
export type SceneType = string | Scene | SceneURLType | Record<string, any>;
|
|
106
|
-
export type SceneWithOptionsType = {
|
|
107
|
-
options: SceneLoadOptions;
|
|
108
|
-
};
|
|
109
|
-
export type SceneLoadType = SceneType | SceneWithOptionsType;
|
|
110
|
-
export declare function isSceneJSON(scene: any): scene is Scene;
|
|
111
|
-
export declare function isSceneURL(scene: any): scene is Scene;
|
|
112
|
-
export declare function isSceneWithOptions(scene: any): scene is SceneWithOptionsType;
|
package/dist/shape/geometry.d.ts
CHANGED
|
@@ -15,9 +15,9 @@ type ShapeGeometryPre = {
|
|
|
15
15
|
};
|
|
16
16
|
export type ShapeData = {
|
|
17
17
|
gs: ShapeGeometryPre[];
|
|
18
|
-
}
|
|
18
|
+
} | {
|
|
19
19
|
g: ShapeGeometryPre;
|
|
20
|
-
}
|
|
20
|
+
} | spec.ShapeGeometry;
|
|
21
21
|
export declare function getGeometryTriangles(geometry: spec.ShapeGeometry, options: {
|
|
22
22
|
indexBase?: number;
|
|
23
23
|
uvTransform?: number[];
|
|
@@ -25,6 +25,6 @@ export declare function getGeometryTriangles(geometry: spec.ShapeGeometry, optio
|
|
|
25
25
|
aPoint: Float32Array;
|
|
26
26
|
index: Uint16Array;
|
|
27
27
|
};
|
|
28
|
-
export declare function getGeometryByShape(shape: ShapeData, uvTransform
|
|
28
|
+
export declare function getGeometryByShape(shape: ShapeData, uvTransform?: number[]): GeometryFromShape;
|
|
29
29
|
export declare function rotateVec2(out: vec2 | number[], vec2: vec2, angleInRad: number): vec2;
|
|
30
30
|
export {};
|
package/dist/texture/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { Texture2DSourceOptions, TextureCubeSourceOptions } from './types';
|
|
3
|
-
import type { Engine } from '../engine';
|
|
4
3
|
type TextureJSONOptions = spec.SerializedTextureSource & spec.TextureConfigOptionsBase & spec.TextureFormatOptions;
|
|
5
|
-
export declare function deserializeMipmapTexture(textureOptions: TextureJSONOptions, bins: ArrayBuffer[],
|
|
4
|
+
export declare function deserializeMipmapTexture(textureOptions: TextureJSONOptions, bins: ArrayBuffer[], assets: Record<string, any>, files?: spec.BinaryFile[]): Promise<Texture2DSourceOptions | TextureCubeSourceOptions>;
|
|
6
5
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/effects-core",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.6",
|
|
4
4
|
"description": "Galacean Effects runtime core for the web",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,10 +42,11 @@
|
|
|
42
42
|
"registry": "https://registry.npmjs.org"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@galacean/effects-specification": "2.0.
|
|
45
|
+
"@galacean/effects-specification": "2.1.0-alpha.0",
|
|
46
46
|
"@galacean/effects-math": "1.1.0",
|
|
47
47
|
"flatbuffers": "24.3.25",
|
|
48
|
-
"uuid": "9.0.1"
|
|
48
|
+
"uuid": "9.0.1",
|
|
49
|
+
"libtess": "1.2.2"
|
|
49
50
|
},
|
|
50
51
|
"scripts": {
|
|
51
52
|
"prebuild": "pnpm clean",
|