@galacean/effects-core 2.9.3 → 2.10.0-alpha.1
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/canvas-pool.d.ts +58 -3
- package/dist/components/base-render-component.d.ts +4 -0
- package/dist/components/canvas-item.d.ts +131 -0
- package/dist/components/canvas-layer.d.ts +23 -0
- package/dist/components/control.d.ts +18 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/composition.d.ts +17 -3
- package/dist/engine.d.ts +29 -5
- package/dist/fallback/migration.d.ts +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12389 -9421
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12375 -9420
- package/dist/index.mjs.map +1 -1
- package/dist/material/types.d.ts +4 -0
- package/dist/material/utils.d.ts +4 -0
- package/dist/math/index.d.ts +3 -2
- package/dist/math/shape/build-adaptive-bezier.d.ts +1 -1
- package/dist/math/value-getters/index.d.ts +1 -0
- package/dist/math/value-getters/reference-curve.d.ts +19 -0
- package/dist/math/value-getters/value-getter-map.d.ts +5 -0
- package/dist/plugin-system.d.ts +6 -4
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/particle/particle-mesh.d.ts +0 -2
- package/dist/plugins/particle/trail-mesh.d.ts +0 -2
- package/dist/plugins/plugin.d.ts +14 -0
- package/dist/plugins/shape/contour-measure.d.ts +43 -0
- package/dist/plugins/shape/contour-path-utils.d.ts +10 -0
- package/dist/plugins/shape/contour-path.d.ts +20 -0
- package/dist/{math → plugins}/shape/graphics-path.d.ts +1 -1
- package/dist/plugins/shape/index.d.ts +2 -0
- package/dist/{components → plugins/shape}/shape-component.d.ts +13 -7
- package/dist/{math → plugins}/shape/shape-path.d.ts +3 -3
- package/dist/plugins/shape/trim-path.d.ts +25 -0
- package/dist/plugins/sprite/sprite-item.d.ts +31 -5
- package/dist/plugins/sprite/sprite.d.ts +42 -0
- package/dist/plugins/text/text-component-base.d.ts +1 -0
- package/dist/plugins/timeline/playable-assets/index.d.ts +1 -0
- package/dist/plugins/timeline/playable-assets/sprite-property-playable-asset.d.ts +23 -0
- package/dist/plugins/timeline/playables/index.d.ts +1 -0
- package/dist/plugins/timeline/playables/sprite-property-mixer-playable.d.ts +11 -0
- package/dist/plugins/timeline/playables/transform-mixer-playable.d.ts +6 -0
- package/dist/plugins/timeline/playables/transform-playable.d.ts +17 -2
- package/dist/plugins/timeline/tracks/index.d.ts +1 -0
- package/dist/plugins/timeline/tracks/sprite-property-track.d.ts +11 -0
- package/dist/plugins/timeline/transform-clip-mixer.d.ts +33 -0
- package/dist/rect-transform.d.ts +145 -0
- package/dist/render/graphics.d.ts +127 -51
- package/dist/render/index.d.ts +1 -0
- package/dist/render/text-cache.d.ts +117 -0
- package/dist/scene.d.ts +7 -4
- package/dist/transform.d.ts +14 -3
- package/dist/utils/index.d.ts +1 -1
- package/package.json +2 -2
package/dist/material/types.d.ts
CHANGED
package/dist/material/utils.d.ts
CHANGED
|
@@ -5,4 +5,8 @@ export declare function valIfUndefined<T>(val: any, def: T): T;
|
|
|
5
5
|
export declare function getPreMultiAlpha(blending?: spec.BlendingMode): number;
|
|
6
6
|
export declare function setBlendMode(material: Material, blendMode?: number): void;
|
|
7
7
|
export declare function setSideMode(material: Material, side: spec.SideMode): void;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated 2.10 起 runtime 内部已不再通过 `MaskMode` 设置模板测试参数。
|
|
10
|
+
* 仅为兼容旧版本对外导出的接口而保留,新代码请勿使用。
|
|
11
|
+
*/
|
|
8
12
|
export declare function setMaskMode(material: Material, maskMode: MaskMode): void;
|
package/dist/math/index.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ export * from './translate';
|
|
|
3
3
|
export * from './utils';
|
|
4
4
|
export * from './value-getters';
|
|
5
5
|
export * from './shape/build-line';
|
|
6
|
-
export * from './shape/graphics-path';
|
|
7
6
|
export * from './shape/ellipse';
|
|
7
|
+
export * from './shape/rectangle';
|
|
8
|
+
export * from './shape/triangle';
|
|
8
9
|
export * from './shape/poly-star';
|
|
10
|
+
export * from './shape/circle';
|
|
9
11
|
export * from './shape/polygon';
|
|
10
|
-
export * from './shape/shape-path';
|
|
11
12
|
export * from './bezier';
|
|
@@ -1 +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, scale?: number): number[];
|
|
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, scale?: number, tValues?: number[]): number[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { EffectsObject } from '../../effects-object';
|
|
2
|
+
import { ValueGetter } from './value-getter';
|
|
3
|
+
/**
|
|
4
|
+
* 对象引用曲线运行时数据:[time, value][],value 为已解析的 EffectsObject 实例。
|
|
5
|
+
*/
|
|
6
|
+
export type ReferenceCurveData<T extends EffectsObject> = [time: number, value: T][];
|
|
7
|
+
/**
|
|
8
|
+
* 通用对象引用阶梯曲线(不插值)。对象引用不可插值,
|
|
9
|
+
* 按时间阶梯采样取 time ≤ t 的最近关键帧。
|
|
10
|
+
*
|
|
11
|
+
* 继承 ValueGetter 以复用 PropertyClipPlayable<T>;数值相关方法
|
|
12
|
+
* (toUniform/toData/getIntegrate*)保留基类 NOT_IMPLEMENT——对象引用 curve
|
|
13
|
+
* 不走 shader 通路。典型用例:T = Sprite(sprite 属性 K 帧切图)。
|
|
14
|
+
*/
|
|
15
|
+
export declare class ReferenceCurve<T extends EffectsObject> extends ValueGetter<T> {
|
|
16
|
+
private keyframes;
|
|
17
|
+
onCreate(props: ReferenceCurveData<T>): void;
|
|
18
|
+
getValue(time?: number): T;
|
|
19
|
+
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { ValueGetter } from './value-getter';
|
|
2
|
+
/**
|
|
3
|
+
* 对象引用阶梯曲线(spec ValueType.REFERENCE_CURVE)。
|
|
4
|
+
* props 为 [[time, value], ...],value 为已解析的对象引用实例。
|
|
5
|
+
*/
|
|
6
|
+
export declare const REFERENCE_CURVE = 28;
|
|
2
7
|
export declare function createValueGetter(args: any): ValueGetter<any>;
|
package/dist/plugin-system.d.ts
CHANGED
|
@@ -17,9 +17,11 @@ export declare function registerPlugin(name: string, pluginClass: PluginConstruc
|
|
|
17
17
|
export declare function unregisterPlugin(name: string): void;
|
|
18
18
|
export declare class PluginSystem {
|
|
19
19
|
static getPlugins(): Plugin[];
|
|
20
|
-
static
|
|
21
|
-
static
|
|
22
|
-
static
|
|
23
|
-
static
|
|
20
|
+
static notifyCompositionCreated(composition: Composition, scene?: Scene): void;
|
|
21
|
+
static notifyCompositionDestroy(composition: Composition): void;
|
|
22
|
+
static notifyEngineCreated(engine: Engine): void;
|
|
23
|
+
static notifyEngineDestroy(engine: Engine): void;
|
|
24
|
+
static notifyAssetsLoadStart(scene: Scene, options?: SceneLoadOptions): Promise<void[]>;
|
|
25
|
+
static notifyAssetsLoadFinish(scene: Scene, options: SceneLoadOptions, engine: Engine): void;
|
|
24
26
|
}
|
|
25
27
|
export declare function getPluginUsageInfo(name: string): string;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './interact/interact-vfx-item';
|
|
|
9
9
|
export * from './interact/interact-item';
|
|
10
10
|
export * from './interact/mesh-collider';
|
|
11
11
|
export * from './sprite/sprite-loader';
|
|
12
|
+
export * from './sprite/sprite';
|
|
12
13
|
export * from './sprite/sprite-item';
|
|
13
14
|
export * from './particle/particle-loader';
|
|
14
15
|
export * from './particle/particle-mesh';
|
|
@@ -17,4 +18,5 @@ export * from './particle/particle-system';
|
|
|
17
18
|
export * from './particle/particle-system-renderer';
|
|
18
19
|
export * from './timeline';
|
|
19
20
|
export * from './text';
|
|
21
|
+
export * from './shape';
|
|
20
22
|
export * from './animation-graph';
|
package/dist/plugins/plugin.d.ts
CHANGED
|
@@ -38,4 +38,18 @@ export declare abstract class Plugin {
|
|
|
38
38
|
* @param composition - 合成对象
|
|
39
39
|
*/
|
|
40
40
|
onCompositionDestroy(composition: Composition): void;
|
|
41
|
+
/**
|
|
42
|
+
* 引擎创建完成后触发。
|
|
43
|
+
* 适用于注册引擎级单例、建立以引擎为键的映射、绑定全局监听等场景。
|
|
44
|
+
* @param engine - 引擎实例
|
|
45
|
+
* @since 2.10.0
|
|
46
|
+
*/
|
|
47
|
+
onEngineCreated(engine: Engine): void;
|
|
48
|
+
/**
|
|
49
|
+
* 引擎销毁时触发。
|
|
50
|
+
* 适合解绑监听、释放引擎级资源或清理以引擎为键的映射。
|
|
51
|
+
* @param engine - 引擎实例
|
|
52
|
+
* @since 2.10.0
|
|
53
|
+
*/
|
|
54
|
+
onEngineDestroy(engine: Engine): void;
|
|
41
55
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Vector2 } from '@galacean/effects-math/es/core/vector2';
|
|
2
|
+
import type { GraphicsPath } from './graphics-path';
|
|
3
|
+
export type ContourMeasureSegmentType = 'line' | 'cubic';
|
|
4
|
+
export type ContourMeasureSegment = {
|
|
5
|
+
distance: number;
|
|
6
|
+
pointIndex: number;
|
|
7
|
+
tValue: number;
|
|
8
|
+
type: ContourMeasureSegmentType;
|
|
9
|
+
smoothness?: number;
|
|
10
|
+
scale?: number;
|
|
11
|
+
};
|
|
12
|
+
export type ContourMeasurePosTan = {
|
|
13
|
+
pos: Vector2;
|
|
14
|
+
tan: Vector2;
|
|
15
|
+
};
|
|
16
|
+
export declare class ContourMeasure {
|
|
17
|
+
private readonly segments;
|
|
18
|
+
private readonly points;
|
|
19
|
+
private readonly contourLength;
|
|
20
|
+
private readonly contourClosed;
|
|
21
|
+
constructor(segments: ContourMeasureSegment[], points: Vector2[], contourLength: number, contourClosed: boolean);
|
|
22
|
+
length(): number;
|
|
23
|
+
isClosed(): boolean;
|
|
24
|
+
getPosTan(distance: number): ContourMeasurePosTan;
|
|
25
|
+
getSegment(startDistance: number, endDistance: number, destination: GraphicsPath, startWithMove: boolean): void;
|
|
26
|
+
warp(source: Vector2): Vector2;
|
|
27
|
+
dump(): void;
|
|
28
|
+
private findSegment;
|
|
29
|
+
private computeT;
|
|
30
|
+
private extractWholeSegment;
|
|
31
|
+
private extractSegment;
|
|
32
|
+
}
|
|
33
|
+
export declare class ContourMeasureIter {
|
|
34
|
+
static readonly defaultTolerance = 0.5;
|
|
35
|
+
private contourPath;
|
|
36
|
+
private cursor;
|
|
37
|
+
private screenScale;
|
|
38
|
+
constructor(source: GraphicsPath, screenScale?: number);
|
|
39
|
+
rewind(source: GraphicsPath, screenScale?: number): void;
|
|
40
|
+
private tryNext;
|
|
41
|
+
next(): ContourMeasure | null;
|
|
42
|
+
toArray(): ContourMeasure[];
|
|
43
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Vector2 } from '@galacean/effects-math/es/core/vector2';
|
|
2
|
+
export declare function clampNumber(value: number, min: number, max: number): number;
|
|
3
|
+
export declare function lerpNumber(start: number, end: number, t: number): number;
|
|
4
|
+
export declare function pointsEqual(left: Vector2, right: Vector2): boolean;
|
|
5
|
+
export declare function clonePoint(point: Vector2): Vector2;
|
|
6
|
+
export declare function normalizeVector2(x: number, y: number): Vector2;
|
|
7
|
+
export declare function cubicPointAt(points: readonly Vector2[], t: number): Vector2;
|
|
8
|
+
export declare function lineExtract(points: readonly Vector2[], startT: number, endT: number): [Vector2, Vector2];
|
|
9
|
+
export declare function cubicSubdivide(points: readonly Vector2[], t: number): [Vector2[], Vector2[]];
|
|
10
|
+
export declare function cubicExtract(points: readonly Vector2[], startT: number, endT: number): Vector2[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Vector2 } from '@galacean/effects-math/es/core/vector2';
|
|
2
|
+
import type { GraphicsPath } from './graphics-path';
|
|
3
|
+
import type { ShapePath } from './shape-path';
|
|
4
|
+
export type ContourPathCommand = {
|
|
5
|
+
action: 'moveTo';
|
|
6
|
+
data: [Vector2];
|
|
7
|
+
} | {
|
|
8
|
+
action: 'lineTo';
|
|
9
|
+
data: [Vector2];
|
|
10
|
+
} | {
|
|
11
|
+
action: 'bezierCurveTo';
|
|
12
|
+
data: [Vector2, Vector2, Vector2];
|
|
13
|
+
smoothness?: number;
|
|
14
|
+
scale?: number;
|
|
15
|
+
} | {
|
|
16
|
+
action: 'closePath';
|
|
17
|
+
data: [];
|
|
18
|
+
};
|
|
19
|
+
export declare function tryMakeContourPathFromGraphicsPath(source: GraphicsPath): ContourPathCommand[] | null;
|
|
20
|
+
export declare function makeContourPathFromShapePath(shapePath: ShapePath, screenScale: number): ContourPathCommand[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
|
|
2
2
|
import { ShapePath } from './shape-path';
|
|
3
|
-
import type { StarType } from '
|
|
3
|
+
import type { StarType } from '../../math';
|
|
4
4
|
export declare class GraphicsPath {
|
|
5
5
|
instructions: PathInstruction[];
|
|
6
6
|
private dirty;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Color } from '@galacean/effects-math/es/core/color';
|
|
2
2
|
import { Vector2 } from '@galacean/effects-math/es/core/vector2';
|
|
3
3
|
import * as spec from '@galacean/effects-specification';
|
|
4
|
-
import type { Engine } from '
|
|
5
|
-
import type { Maskable } from '
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
4
|
+
import type { Engine } from '../../engine';
|
|
5
|
+
import type { Maskable } from '../../material';
|
|
6
|
+
import type { Renderer } from '../../render';
|
|
7
|
+
import type { GradientValue } from '../../math';
|
|
8
|
+
import { RendererComponent } from '../../components';
|
|
9
|
+
import type { Texture } from '../../texture/texture';
|
|
10
|
+
import { TrimPath } from './trim-path';
|
|
11
|
+
import type { BoundingBoxInfo } from '../interact/mesh-collider';
|
|
12
|
+
import type { BoundingBoxTriangle, HitTestTriangleParams } from '../interact/click-handler';
|
|
11
13
|
export interface SolidPaint {
|
|
12
14
|
type: spec.FillType.Solid;
|
|
13
15
|
color: Color;
|
|
@@ -134,11 +136,15 @@ export declare class ShapeComponent extends RendererComponent implements Maskabl
|
|
|
134
136
|
private strokeJoin;
|
|
135
137
|
private strokes;
|
|
136
138
|
private shapeAttributes;
|
|
139
|
+
private _strokeTrimPath;
|
|
140
|
+
private _fillTrimPath;
|
|
137
141
|
private rendererOptions;
|
|
138
142
|
private geometry;
|
|
139
143
|
private fillMaterials;
|
|
140
144
|
private strokeMaterials;
|
|
141
145
|
get shape(): ShapeAttributes;
|
|
146
|
+
get strokeTrimPath(): TrimPath | null;
|
|
147
|
+
get fillTrimPath(): TrimPath | null;
|
|
142
148
|
/**
|
|
143
149
|
*
|
|
144
150
|
* @param engine
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
|
|
2
|
-
import { Polygon } from './polygon';
|
|
3
2
|
import type { GraphicsPath } from './graphics-path';
|
|
4
|
-
import type { ShapePrimitive } from '
|
|
5
|
-
import type { StarType } from '
|
|
3
|
+
import type { ShapePrimitive } from '../../math/shape/shape-primitive';
|
|
4
|
+
import type { StarType } from '../../math';
|
|
5
|
+
import { Polygon } from '../../math';
|
|
6
6
|
export declare class ShapePath {
|
|
7
7
|
private graphicsPath;
|
|
8
8
|
currentPoly: Polygon | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GraphicsPath } from './graphics-path';
|
|
2
|
+
export interface TrimPathData {
|
|
3
|
+
start: number;
|
|
4
|
+
end: number;
|
|
5
|
+
offset: number;
|
|
6
|
+
mode: TrimPathMode;
|
|
7
|
+
}
|
|
8
|
+
export declare enum TrimPathMode {
|
|
9
|
+
Synchronized = 0,
|
|
10
|
+
Sequential = 1
|
|
11
|
+
}
|
|
12
|
+
export declare class TrimPath {
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
offset: number;
|
|
16
|
+
mode: TrimPathMode;
|
|
17
|
+
private trimmedGraphicsPath;
|
|
18
|
+
clone(): TrimPath;
|
|
19
|
+
createTrimmedPath(source: GraphicsPath, screenScale: number): GraphicsPath;
|
|
20
|
+
isIdentity(): boolean;
|
|
21
|
+
fromData(data: TrimPathData): void;
|
|
22
|
+
private normalizeTrimOffset;
|
|
23
|
+
private applySequentialTrimPath;
|
|
24
|
+
private applySynchronizedTrimPath;
|
|
25
|
+
}
|
|
@@ -5,6 +5,7 @@ import type { FrameContext } from '../timeline';
|
|
|
5
5
|
import { Playable, PlayableAsset, TrackMixerPlayable, TrackAsset } from '../timeline';
|
|
6
6
|
import type { Geometry } from '../../render';
|
|
7
7
|
import { MaskableGraphic } from '../../components';
|
|
8
|
+
import type { Sprite } from './sprite';
|
|
8
9
|
/**
|
|
9
10
|
* 图层元素基础属性, 经过处理后的 spec.SpriteContent.options
|
|
10
11
|
*/
|
|
@@ -12,7 +13,14 @@ export type SpriteItemOptions = {
|
|
|
12
13
|
startColor: spec.vec4;
|
|
13
14
|
renderLevel?: spec.RenderLevel;
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* SpriteComponent 数据。扩展 spec.SpriteComponentData,新增可选 sprite 资产引用。
|
|
18
|
+
* spec 包不可改,故本地扩展。
|
|
19
|
+
*/
|
|
20
|
+
interface SpriteComponentDataEx extends spec.SpriteComponentData {
|
|
21
|
+
/** 引用的 Sprite 资产(新版数据流);老数据经 version37Migration 迁移而来 */
|
|
22
|
+
sprite?: spec.DataPath;
|
|
23
|
+
}
|
|
16
24
|
export declare class SpriteColorPlayableAsset extends PlayableAsset {
|
|
17
25
|
data: ColorPlayableAssetData;
|
|
18
26
|
createPlayable(): Playable;
|
|
@@ -40,15 +48,33 @@ export declare class SpriteComponent extends MaskableGraphic {
|
|
|
40
48
|
time: number;
|
|
41
49
|
duration: number;
|
|
42
50
|
protected textureSheetAnimation?: spec.TextureSheetAnimation;
|
|
43
|
-
|
|
51
|
+
/**
|
|
52
|
+
* 引用的 Sprite 资产(纹理 + 归一化 UV 矩形 + rotation),渲染唯一数据源。
|
|
53
|
+
*/
|
|
54
|
+
protected _sprite: Sprite;
|
|
55
|
+
/**
|
|
56
|
+
* 当前 Sprite 资产。设置时同步纹理、重绑 _MainTex 并重建几何体 UV。
|
|
57
|
+
* @since 2.10.0
|
|
58
|
+
*/
|
|
59
|
+
get sprite(): Sprite;
|
|
60
|
+
set sprite(sprite: Sprite);
|
|
61
|
+
constructor(engine: Engine, props?: SpriteComponentDataEx);
|
|
44
62
|
onUpdate(dt: number): void;
|
|
45
63
|
onDisable(): void;
|
|
46
64
|
onDestroy(): void;
|
|
47
65
|
protected updateGeometry(geometry: Geometry): void;
|
|
66
|
+
fromData(data: SpriteComponentDataEx): void;
|
|
67
|
+
/**
|
|
68
|
+
* 应用 Sprite 资产到渲染器:同步纹理并重绑 _MainTex。不重建几何体。
|
|
69
|
+
* fromData(后续自行 updateGeometry)与 sprite setter(随后 updateGeometry)共用。
|
|
70
|
+
* 直接写 _sprite,避免经 setter 触发 updateGeometry。
|
|
71
|
+
*/
|
|
72
|
+
protected applySpriteToRenderer(sprite: Sprite): void;
|
|
48
73
|
/**
|
|
49
74
|
* @deprecated
|
|
50
|
-
*
|
|
75
|
+
* 原有打包纹理拆分逻辑,仅在老数据 splits.length>1(2x2 纹理打包)时使用,保留向后兼容。
|
|
76
|
+
* 不依赖组件状态,splits 由参数传入(同时存在帧动画与多 split 的数据不存在)。
|
|
51
77
|
*/
|
|
52
|
-
protected updateGeometryFromMultiSplit(): void;
|
|
53
|
-
fromData(data: spec.SpriteComponentData): void;
|
|
78
|
+
protected updateGeometryFromMultiSplit(splits: spec.SplitParameter[]): void;
|
|
54
79
|
}
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
2
|
+
import { EffectsObject } from '../../effects-object';
|
|
3
|
+
import type { Engine } from '../../engine';
|
|
4
|
+
import type { Texture } from '../../texture';
|
|
5
|
+
/**
|
|
6
|
+
* Sprite UV 旋转方式。序列化为整数(兼容老 splits 的 flip 0/1)。
|
|
7
|
+
* None 不旋转、Rotate90 将 UV 顺时针旋转 90°(width/height 互换)。
|
|
8
|
+
*/
|
|
9
|
+
export declare enum SpriteRotation {
|
|
10
|
+
/** 不旋转 */
|
|
11
|
+
None = 0,
|
|
12
|
+
/** UV 旋转 90°(对应老 splits flip=1) */
|
|
13
|
+
Rotate90 = 1
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Sprite 资产数据
|
|
17
|
+
*/
|
|
18
|
+
export interface SpriteData extends spec.EffectsObjectData {
|
|
19
|
+
/** 关联纹理(DataPath 引用) */
|
|
20
|
+
texture?: spec.DataPath;
|
|
21
|
+
/** 归一化 UV 矩形 [x, y, w, h],默认整张纹理 */
|
|
22
|
+
rect?: spec.vec4;
|
|
23
|
+
/** UV 旋转方式(0=None, 1=Rotate90),对齐老 splits 的 flip 语义 */
|
|
24
|
+
rotation?: SpriteRotation;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Sprite 资产:一张纹理 + 一个归一化 UV 矩形区域(不含 border/pivot)。
|
|
28
|
+
* 被 SpriteComponent 引用,替代直接引用 Texture + 散落的 splits。
|
|
29
|
+
*
|
|
30
|
+
* 反序列化全部集中在 fromData 手动解析(与 SpriteComponent 风格一致),
|
|
31
|
+
* 不使用 @serialize 装饰器,避免序列化/反序列化双路径带来的引用覆盖陷阱。
|
|
32
|
+
*/
|
|
33
|
+
export declare class Sprite extends EffectsObject {
|
|
34
|
+
/** 关联的纹理对象 */
|
|
35
|
+
texture: Texture;
|
|
36
|
+
/** 归一化 UV 矩形 [x, y, w, h],默认整张纹理 */
|
|
37
|
+
rect: spec.vec4;
|
|
38
|
+
/** UV 旋转方式(对应老 splits 的 flip 0/1) */
|
|
39
|
+
rotation: SpriteRotation;
|
|
40
|
+
constructor(engine: Engine, props?: SpriteData);
|
|
41
|
+
fromData(data: SpriteData): void;
|
|
42
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './activation-playable-asset';
|
|
2
2
|
export * from './color-property-playable-asset';
|
|
3
3
|
export * from './float-property-playable-asset';
|
|
4
|
+
export * from './sprite-property-playable-asset';
|
|
4
5
|
export * from './sub-composition-playable-asset';
|
|
5
6
|
export * from './vector-property-playable-assets';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
2
|
+
import type { Playable } from '../playable';
|
|
3
|
+
import { PlayableAsset } from '../playable';
|
|
4
|
+
import type { ReferenceCurveData } from '../../../math';
|
|
5
|
+
import type { Sprite } from '../../sprite/sprite';
|
|
6
|
+
/**
|
|
7
|
+
* 对象引用曲线序列化值:[REFERENCE_CURVE, [time, DataPath][]],value 为 {id} 引用。
|
|
8
|
+
* 序列化形态,无泛型。
|
|
9
|
+
* TODO: update to spec.
|
|
10
|
+
*/
|
|
11
|
+
export type ReferenceCurveValue = [number, [number, spec.DataPath][]];
|
|
12
|
+
export interface SpritePropertyAssetData extends spec.EffectsObjectData {
|
|
13
|
+
curveData: ReferenceCurveValue;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Sprite 属性 K 帧 PlayableAsset:curveData 为对象引用阶梯曲线,
|
|
17
|
+
* createPlayable 复用 PropertyClipPlayable<Sprite> + ReferenceCurve(阶梯采样,不插值)。
|
|
18
|
+
*/
|
|
19
|
+
export declare class SpritePropertyPlayableAsset extends PlayableAsset {
|
|
20
|
+
curveData: [number, ReferenceCurveData<Sprite>];
|
|
21
|
+
fromData(data: SpritePropertyAssetData): void;
|
|
22
|
+
createPlayable(): Playable;
|
|
23
|
+
}
|
|
@@ -5,6 +5,7 @@ export * from './float-property-mixer-playable';
|
|
|
5
5
|
export * from './particle-mixer-playable';
|
|
6
6
|
export * from './property-clip-playable';
|
|
7
7
|
export * from './sprite-color-mixer-playable';
|
|
8
|
+
export * from './sprite-property-mixer-playable';
|
|
8
9
|
export * from './sub-composition-clip-playable';
|
|
9
10
|
export * from './sub-composition-mixer-playable';
|
|
10
11
|
export * from './track-mixer-playable';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FrameContext } from '../playable';
|
|
2
|
+
import { TrackMixerPlayable } from './track-mixer-playable';
|
|
3
|
+
/**
|
|
4
|
+
* Sprite 属性 K 帧 mixer。对象引用不混合:取首个激活 clip 的阶梯采样值,
|
|
5
|
+
* 赋值 boundObject.sprite 触发 setter(同步纹理 + 重建 UV)。
|
|
6
|
+
* 不继承 PropertyMixerPlayable(其 evaluate 开头"读当前值为 null 则 return"
|
|
7
|
+
* 会阻断无初始 sprite 组件的 K 帧)。
|
|
8
|
+
*/
|
|
9
|
+
export declare class SpritePropertyMixerPlayable extends TrackMixerPlayable {
|
|
10
|
+
evaluate(context: FrameContext): void;
|
|
11
|
+
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { FrameContext } from '../playable';
|
|
2
2
|
import { TrackMixerPlayable } from './track-mixer-playable';
|
|
3
|
+
/**
|
|
4
|
+
* TransformTrack 的 mixer。
|
|
5
|
+
* 收集当前激活的 Transform clip contribution,并委托 TransformClipMixer 合成当前帧输出。
|
|
6
|
+
*/
|
|
3
7
|
export declare class TransformMixerPlayable extends TrackMixerPlayable {
|
|
8
|
+
private readonly clipMixer;
|
|
9
|
+
dispose(): void;
|
|
4
10
|
evaluate(context: FrameContext): void;
|
|
5
11
|
}
|
|
@@ -13,6 +13,14 @@ export type ItemBasicTransform = {
|
|
|
13
13
|
scale: Vector3;
|
|
14
14
|
path?: ValueGetter<Vector3>;
|
|
15
15
|
};
|
|
16
|
+
export type TransformContribution = {
|
|
17
|
+
hasPosition: boolean;
|
|
18
|
+
position: Vector3;
|
|
19
|
+
hasRotation: boolean;
|
|
20
|
+
rotation: Euler;
|
|
21
|
+
hasScale: boolean;
|
|
22
|
+
scale: Vector3;
|
|
23
|
+
};
|
|
16
24
|
/**
|
|
17
25
|
* @since 2.0.0
|
|
18
26
|
*/
|
|
@@ -45,15 +53,22 @@ export declare class TransformPlayable extends Playable {
|
|
|
45
53
|
gravity: Vector3;
|
|
46
54
|
direction: Vector3;
|
|
47
55
|
startSpeed: number;
|
|
56
|
+
pathGetter?: ValueGetter<Vector3>;
|
|
48
57
|
data: TransformPlayableAssetData;
|
|
49
58
|
private velocity;
|
|
50
|
-
private
|
|
59
|
+
private started;
|
|
60
|
+
private readonly contribution;
|
|
51
61
|
start(): void;
|
|
52
62
|
processFrame(context: FrameContext): void;
|
|
53
63
|
/**
|
|
54
|
-
*
|
|
64
|
+
* 采样当前帧相对 base pose 的 transform contribution。
|
|
65
|
+
* 返回值为内部复用对象,调用方应在当前帧同步消费,不应缓存。
|
|
66
|
+
* @param basePosition - orbital position 计算 contribution 时使用的参考位置。
|
|
55
67
|
*/
|
|
68
|
+
getContribution(basePosition?: Vector3): TransformContribution;
|
|
69
|
+
private ensureStarted;
|
|
56
70
|
private sampleAnimation;
|
|
71
|
+
private captureOriginalTransform;
|
|
57
72
|
}
|
|
58
73
|
export declare class TransformPlayableAsset extends PlayableAsset {
|
|
59
74
|
transformAnimationData: TransformPlayableAssetData;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TrackMixerPlayable } from '../playables';
|
|
2
|
+
import { PropertyTrack } from './property-track';
|
|
3
|
+
/**
|
|
4
|
+
* Sprite 属性 K 帧 track。绑定到 SpriteComponent(updateAnimatedObject),
|
|
5
|
+
* mixer 取激活 clip 的 Sprite 采样值赋值 sprite 属性。
|
|
6
|
+
* path('sprite')为编辑器元数据,mixer 直接写 boundObject.sprite。
|
|
7
|
+
*/
|
|
8
|
+
export declare class SpritePropertyTrack extends PropertyTrack {
|
|
9
|
+
createTrackMixer(): TrackMixerPlayable;
|
|
10
|
+
updateAnimatedObject(boundObject: object): object;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
2
|
+
import type { VFXItem } from '../../vfx-item';
|
|
3
|
+
import type { TransformContribution } from './playables/transform-playable';
|
|
4
|
+
/**
|
|
5
|
+
* 对 TransformTrack 当前激活的 Transform clip contribution 做帧内合成。
|
|
6
|
+
* position 与 rotation 使用增量语义,scale 使用乘子语义;结果由 flush 统一写回。
|
|
7
|
+
*/
|
|
8
|
+
export declare class TransformClipMixer {
|
|
9
|
+
private basePose?;
|
|
10
|
+
private boundInstanceId?;
|
|
11
|
+
private hasContribution;
|
|
12
|
+
private hasPosition;
|
|
13
|
+
private hasRotation;
|
|
14
|
+
private hasScale;
|
|
15
|
+
private appliedPosition;
|
|
16
|
+
private appliedRotation;
|
|
17
|
+
private appliedScale;
|
|
18
|
+
private readonly outPos;
|
|
19
|
+
private readonly outRot;
|
|
20
|
+
private readonly outScale;
|
|
21
|
+
private readonly weightedRot;
|
|
22
|
+
captureBasePose(item: VFXItem): void;
|
|
23
|
+
/**
|
|
24
|
+
* orbital position 的 contribution 依赖 base position。
|
|
25
|
+
* 这里返回 mixer 持有的 base,确保采样和合成使用同一份参考姿态。
|
|
26
|
+
*/
|
|
27
|
+
getBasePosition(): Vector3 | undefined;
|
|
28
|
+
resetFrame(): void;
|
|
29
|
+
addContribution(item: VFXItem, contribution: TransformContribution, weight: number): void;
|
|
30
|
+
flush(item: VFXItem): void;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
private ensureBasePose;
|
|
33
|
+
}
|