@galacean/effects-core 2.0.0-alpha.17 → 2.0.0-alpha.19
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/composition.d.ts +5 -4
- package/dist/constants.d.ts +1 -1
- package/dist/decorators.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +11107 -9095
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11053 -9022
- package/dist/index.mjs.map +1 -1
- package/dist/material/utils.d.ts +3 -3
- package/dist/math/value-getter.d.ts +1 -0
- package/dist/plugins/cal/calculate-vfx-item.d.ts +1 -0
- package/dist/plugins/cal/timeline-asset.d.ts +2 -2
- package/dist/plugins/particle/particle-mesh.d.ts +1 -1
- package/dist/plugins/particle/particle-vfx-item.d.ts +1 -0
- package/dist/plugins/particle/trail-mesh.d.ts +1 -1
- package/dist/plugins/sprite/sprite-mesh.d.ts +0 -4
- package/dist/plugins/text/text-item.d.ts +18 -5
- package/dist/plugins/timeline/track.d.ts +4 -2
- package/dist/render/shader.d.ts +4 -4
- package/dist/texture/utils.d.ts +1 -1
- package/dist/utils/array.d.ts +1 -1
- package/dist/utils/index.d.ts +4 -0
- package/dist/vfx-item.d.ts +5 -5
- package/package.json +1 -1
package/dist/material/utils.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import * as spec from '@galacean/effects-specification';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ShaderMacros } from '../render';
|
|
3
3
|
import type { Material } from './material';
|
|
4
4
|
import { ShaderType } from './types';
|
|
5
5
|
export declare function valIfUndefined<T>(val: any, def: T): T;
|
|
6
6
|
export declare function getPreMultiAlpha(blending?: number): number;
|
|
7
7
|
/**
|
|
8
8
|
* 生成 shader,检测到 WebGL1 上下文会降级
|
|
9
|
-
* @param
|
|
9
|
+
* @param macros - 宏定义数组
|
|
10
10
|
* @param shader - 原始 shader 文本
|
|
11
11
|
* @param shaderType - shader 类型
|
|
12
12
|
* @return 去除版本号的 shader 文本
|
|
13
13
|
*/
|
|
14
|
-
export declare function
|
|
14
|
+
export declare function createShaderWithMacros(macros: ShaderMacros, shader: string, shaderType: ShaderType, level: number): string;
|
|
15
15
|
export declare function setBlendMode(material: Material, blendMode?: number): void;
|
|
16
16
|
export declare function setSideMode(material: Material, side: spec.SideMode): void;
|
|
17
17
|
export declare function setMaskMode(material: Material, maskMode: spec.MaskMode): void;
|
|
@@ -33,6 +33,7 @@ export declare class StaticValue extends ValueGetter<number> {
|
|
|
33
33
|
getValue(time?: number): number;
|
|
34
34
|
toUniform(): Float32Array;
|
|
35
35
|
map(func: (n: number) => number): this;
|
|
36
|
+
getMaxTime(): number;
|
|
36
37
|
}
|
|
37
38
|
export declare class RandomSetValue<T> extends ValueGetter<T> {
|
|
38
39
|
private items;
|
|
@@ -103,6 +103,7 @@ export interface FloatCurve {
|
|
|
103
103
|
keyFrames: ValueGetter<number>;
|
|
104
104
|
}
|
|
105
105
|
export declare class AnimationClip extends EffectsObject {
|
|
106
|
+
duration: number;
|
|
106
107
|
positionCurves: PositionCurve[];
|
|
107
108
|
rotationCurves: RotationCurve[];
|
|
108
109
|
scaleCurves: ScaleCurve[];
|
|
@@ -2,14 +2,14 @@ import type { DataPath, EffectsObjectData } from '@galacean/effects-specificatio
|
|
|
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';
|
|
5
|
-
import type {
|
|
5
|
+
import type { Constructor } from '../../utils';
|
|
6
6
|
export interface TimelineAssetData extends EffectsObjectData {
|
|
7
7
|
tracks: DataPath[];
|
|
8
8
|
}
|
|
9
9
|
export declare class TimelineAsset extends PlayableAsset {
|
|
10
10
|
tracks: TrackAsset[];
|
|
11
11
|
createPlayable(graph: PlayableGraph): Playable;
|
|
12
|
-
createTrack<T extends TrackAsset>(classConstructor:
|
|
12
|
+
createTrack<T extends TrackAsset>(classConstructor: Constructor<T>, parent: TrackAsset, name?: string): T;
|
|
13
13
|
fromData(data: TimelineAssetData): void;
|
|
14
14
|
}
|
|
15
15
|
export declare class TimelinePlayable extends Playable {
|
|
@@ -151,7 +151,7 @@ export declare class ParticleMesh implements ParticleMeshData {
|
|
|
151
151
|
removePoint(index: number): void;
|
|
152
152
|
setPoint(index: number, point: Point): void;
|
|
153
153
|
}
|
|
154
|
-
export declare function getParticleMeshShader(item: spec.ParticleItem,
|
|
154
|
+
export declare function getParticleMeshShader(item: spec.ParticleItem, gpuCapability: GPUCapability, env?: string): {
|
|
155
155
|
shader: SharedShaderWithSource;
|
|
156
156
|
vertex: number;
|
|
157
157
|
fragment: number;
|
|
@@ -7,6 +7,7 @@ import { ParticleSystem } from './particle-system';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class ParticleBehaviourPlayable extends Playable {
|
|
9
9
|
particleSystem: ParticleSystem;
|
|
10
|
+
lastTime: number;
|
|
10
11
|
start(context: FrameContext): void;
|
|
11
12
|
processFrame(context: FrameContext): void;
|
|
12
13
|
}
|
|
@@ -56,4 +56,4 @@ export declare class TrailMesh {
|
|
|
56
56
|
setPointStartPos(index: number, pos: Vector3): void;
|
|
57
57
|
onUpdate(escapeTime: number): any;
|
|
58
58
|
}
|
|
59
|
-
export declare function getTrailMeshShader(trails: spec.ParticleTrail, particleMaxCount: number, name: string,
|
|
59
|
+
export declare function getTrailMeshShader(trails: spec.ParticleTrail, particleMaxCount: number, name: string, gpuCapability: GPUCapability, env?: string): ShaderWithSource;
|
|
@@ -20,16 +20,12 @@ export type SpriteRegionData = {
|
|
|
20
20
|
size: spec.vec2;
|
|
21
21
|
};
|
|
22
22
|
export declare let maxSpriteMeshItemCount: number;
|
|
23
|
-
export declare let maxSpriteTextureCount: number;
|
|
24
23
|
export declare function setSpriteMeshMaxItemCountByGPU(gpuCapability: GPUCapabilityDetail): 16 | 32 | undefined;
|
|
25
24
|
export declare function getImageItemRenderInfo(item: SpriteComponent): SpriteItemRenderInfo;
|
|
26
25
|
export declare function spriteMeshShaderFromFilter(level: number, options?: {
|
|
27
|
-
count?: number;
|
|
28
|
-
ignoreBlend?: boolean;
|
|
29
26
|
wireframe?: boolean;
|
|
30
27
|
env?: string;
|
|
31
28
|
}): SharedShaderWithSource;
|
|
32
29
|
export declare function spriteMeshShaderIdFromRenderInfo(renderInfo: SpriteItemRenderInfo, count: number): string;
|
|
33
30
|
export declare function spriteMeshShaderFromRenderInfo(renderInfo: SpriteItemRenderInfo, count: number, level: number, env?: string): SharedShaderWithSource;
|
|
34
31
|
export declare function setMaxSpriteMeshItemCount(count: number): void;
|
|
35
|
-
export declare function setSpriteMeshMaxFragmentTextures(count: number): void;
|
|
@@ -4,20 +4,35 @@ import type { SpriteItemProps } from '../sprite/sprite-item';
|
|
|
4
4
|
import { SpriteComponent } from '../sprite/sprite-item';
|
|
5
5
|
import { TextLayout } from './text-layout';
|
|
6
6
|
import { TextStyle } from './text-style';
|
|
7
|
+
import type { Material } from '../../material';
|
|
7
8
|
export declare const DEFAULT_FONTS: string[];
|
|
9
|
+
export interface TextComponent extends TextComponentBase {
|
|
10
|
+
}
|
|
8
11
|
/**
|
|
9
12
|
* @since 2.0.0
|
|
10
13
|
* @internal
|
|
11
14
|
*/
|
|
12
15
|
export declare class TextComponent extends SpriteComponent {
|
|
13
|
-
textStyle: TextStyle;
|
|
14
16
|
isDirty: boolean;
|
|
17
|
+
constructor(engine: Engine, props?: spec.TextContent);
|
|
18
|
+
update(dt: number): void;
|
|
19
|
+
fromData(data: SpriteItemProps): void;
|
|
20
|
+
updateWithOptions(options: spec.TextContentOptions): void;
|
|
21
|
+
updateTexture(flipY?: boolean): void;
|
|
22
|
+
}
|
|
23
|
+
export declare class TextComponentBase {
|
|
24
|
+
textStyle: TextStyle;
|
|
15
25
|
canvas: HTMLCanvasElement;
|
|
16
26
|
context: CanvasRenderingContext2D | null;
|
|
17
27
|
textLayout: TextLayout;
|
|
18
28
|
text: string;
|
|
29
|
+
/***** mix 类型兼容用 *****/
|
|
30
|
+
isDirty: boolean;
|
|
31
|
+
engine: Engine;
|
|
32
|
+
material: Material;
|
|
33
|
+
/***** mix 类型兼容用 *****/
|
|
19
34
|
private char;
|
|
20
|
-
|
|
35
|
+
updateWithOptions(options: spec.TextContentOptions): void;
|
|
21
36
|
/**
|
|
22
37
|
* 设置字号大小
|
|
23
38
|
* @param value - 字号
|
|
@@ -108,13 +123,11 @@ export declare class TextComponent extends SpriteComponent {
|
|
|
108
123
|
* @returns
|
|
109
124
|
*/
|
|
110
125
|
setFontScale(value: number): void;
|
|
111
|
-
update(dt: number): void;
|
|
112
126
|
/**
|
|
113
127
|
* 更新文本
|
|
114
128
|
* @returns
|
|
115
129
|
*/
|
|
116
|
-
updateTexture(): void;
|
|
117
|
-
fromData(data: SpriteItemProps): void;
|
|
130
|
+
updateTexture(flipY?: boolean): void;
|
|
118
131
|
private getFontDesc;
|
|
119
132
|
private setupOutline;
|
|
120
133
|
private setupShadow;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ItemEndBehavior } from '@galacean/effects-specification';
|
|
2
|
-
import type { Engine } from '../../engine';
|
|
3
2
|
import type { PlayableGraph } from '../cal/playable-graph';
|
|
4
3
|
import { Playable, PlayableAsset, PlayableOutput } from '../cal/playable-graph';
|
|
4
|
+
import { ParticleSystem } from '../particle/particle-system';
|
|
5
|
+
import type { Constructor } from '../../utils';
|
|
5
6
|
/**
|
|
6
7
|
* @since 2.0.0
|
|
7
8
|
* @internal
|
|
@@ -42,7 +43,7 @@ export declare class TrackAsset extends PlayableAsset {
|
|
|
42
43
|
createPlayable(graph: PlayableGraph): Playable;
|
|
43
44
|
getChildTracks(): TrackAsset[];
|
|
44
45
|
addChild(child: TrackAsset): void;
|
|
45
|
-
createClip<T extends PlayableAsset>(classConstructor:
|
|
46
|
+
createClip<T extends PlayableAsset>(classConstructor: Constructor<T>, name?: string): TimelineClip;
|
|
46
47
|
getClips(): TimelineClip[];
|
|
47
48
|
findClip(name: string): TimelineClip | undefined;
|
|
48
49
|
addClip(clip: TimelineClip): void;
|
|
@@ -57,6 +58,7 @@ export declare class RuntimeClip {
|
|
|
57
58
|
playable: Playable;
|
|
58
59
|
parentMixer: Playable;
|
|
59
60
|
track: TrackAsset;
|
|
61
|
+
particleSystem: ParticleSystem;
|
|
60
62
|
constructor(clip: TimelineClip, clipPlayable: Playable, parentMixer: Playable, track: TrackAsset);
|
|
61
63
|
set enable(value: boolean);
|
|
62
64
|
evaluateAt(localTime: number): void;
|
package/dist/render/shader.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
2
|
import { EffectsObject } from '../effects-object';
|
|
3
3
|
import type { Engine } from '../engine';
|
|
4
|
-
export type
|
|
4
|
+
export type ShaderMacros = [key: string, value: string | number | boolean][];
|
|
5
5
|
export declare enum ShaderCompileResultStatus {
|
|
6
6
|
noShader = 0,
|
|
7
7
|
success = 1,
|
|
@@ -39,7 +39,7 @@ export interface InstancedShaderWithSource {
|
|
|
39
39
|
/**
|
|
40
40
|
* shader的宏定义
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
macros?: ShaderMacros;
|
|
43
43
|
/**
|
|
44
44
|
* shader是否共享
|
|
45
45
|
*/
|
|
@@ -65,7 +65,7 @@ export interface SharedShaderWithSource {
|
|
|
65
65
|
/**
|
|
66
66
|
* shader的宏定义
|
|
67
67
|
*/
|
|
68
|
-
|
|
68
|
+
macros?: ShaderMacros;
|
|
69
69
|
/**
|
|
70
70
|
* 是否共用GLProgram
|
|
71
71
|
* shared为true时,
|
|
@@ -94,7 +94,7 @@ export interface ShaderLibrary {
|
|
|
94
94
|
[cacheId: string]: ShaderCompileResult;
|
|
95
95
|
};
|
|
96
96
|
addShader(shader: ShaderWithSource): void;
|
|
97
|
-
createShader(shaderSource: ShaderWithSource, macros?:
|
|
97
|
+
createShader(shaderSource: ShaderWithSource, macros?: ShaderMacros): ShaderVariant;
|
|
98
98
|
/**
|
|
99
99
|
* @param cacheId
|
|
100
100
|
*/
|
package/dist/texture/utils.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import type * as spec from '@galacean/effects-specification';
|
|
|
2
2
|
import type { Texture2DSourceOptions, TextureCubeSourceOptions } from './types';
|
|
3
3
|
import type { Engine } from '../engine';
|
|
4
4
|
type TextureJSONOptions = spec.SerializedTextureSource & spec.TextureConfigOptionsBase & spec.TextureFormatOptions;
|
|
5
|
-
export declare function deserializeMipmapTexture(
|
|
5
|
+
export declare function deserializeMipmapTexture(textureOptions: TextureJSONOptions, bins: ArrayBuffer[], engine: Engine, files?: spec.BinaryFile[]): Promise<Texture2DSourceOptions | TextureCubeSourceOptions>;
|
|
6
6
|
export {};
|
package/dist/utils/array.d.ts
CHANGED
|
@@ -16,4 +16,4 @@ export declare function removeItem<T>(arr: T[], value: T): T[];
|
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
18
|
export declare function addItemWithOrder<T extends Record<string, any>>(arr: T[], item: T, property: string, descending?: boolean): void;
|
|
19
|
-
export declare function enlargeBuffer<T extends TypedArray>(typeArray: T, length: number,
|
|
19
|
+
export declare function enlargeBuffer<T extends TypedArray>(typeArray: T, length: number, maxSize: number, increase?: number): T;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export type Immutable<O> = O extends Record<any, any> ? {
|
|
|
12
12
|
export type PickEnum<T, K extends T> = {
|
|
13
13
|
[P in keyof K]: P extends K ? P : never;
|
|
14
14
|
};
|
|
15
|
+
export interface Constructor<T = unknown> {
|
|
16
|
+
new (...args: any[]): T;
|
|
17
|
+
}
|
|
15
18
|
export declare enum DestroyOptions {
|
|
16
19
|
destroy = 0,
|
|
17
20
|
keep = 1,
|
|
@@ -77,3 +80,4 @@ export declare function randomInRange(min: number, max: number): number;
|
|
|
77
80
|
export declare function throwDestroyedError(): void;
|
|
78
81
|
export declare function generateGUID(): string;
|
|
79
82
|
export declare function base64ToFile(base64: string, filename?: string, contentType?: string): File;
|
|
83
|
+
export declare function applyMixins<T extends Constructor, K extends Constructor>(derivedCtrl: T, baseCtrls: K[]): void;
|
package/dist/vfx-item.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { EffectsObject } from './effects-object';
|
|
|
7
7
|
import type { Engine } from './engine';
|
|
8
8
|
import type { BoundingBoxData, CameraController, HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, HitTestTriangleParams, InteractComponent, ParticleSystem, SpriteComponent } from './plugins';
|
|
9
9
|
import { Transform } from './transform';
|
|
10
|
-
import {
|
|
11
|
-
export type VFXItemContent = ParticleSystem | SpriteComponent | CameraController | InteractComponent |
|
|
10
|
+
import type { Constructor, Disposable } from './utils';
|
|
11
|
+
export type VFXItemContent = ParticleSystem | SpriteComponent | CameraController | InteractComponent | undefined | {};
|
|
12
12
|
export type VFXItemConstructor = new (engine: Engine, props: VFXItemProps, composition: Composition) => VFXItem;
|
|
13
13
|
export type VFXItemProps = spec.Item & {
|
|
14
14
|
items: VFXItemProps[];
|
|
@@ -122,19 +122,19 @@ export declare class VFXItem extends EffectsObject implements Disposable {
|
|
|
122
122
|
* 添加组件
|
|
123
123
|
* @param classConstructor - 要添加的组件类型
|
|
124
124
|
*/
|
|
125
|
-
addComponent<T extends Component>(classConstructor:
|
|
125
|
+
addComponent<T extends Component>(classConstructor: Constructor<T>): T;
|
|
126
126
|
/**
|
|
127
127
|
* 获取某一类型的组件。如果当前元素绑定了多个同类型的组件只返回第一个
|
|
128
128
|
* @param classConstructor - 要获取的组件类型
|
|
129
129
|
* @returns 查询结果中符合类型的第一个组件
|
|
130
130
|
*/
|
|
131
|
-
getComponent<T extends Component>(classConstructor:
|
|
131
|
+
getComponent<T extends Component>(classConstructor: Constructor<T>): T;
|
|
132
132
|
/**
|
|
133
133
|
* 获取某一类型的所有组件
|
|
134
134
|
* @param classConstructor - 要获取的组件
|
|
135
135
|
* @returns 一个组件列表,包含所有符合类型的组件
|
|
136
136
|
*/
|
|
137
|
-
getComponents<T extends Component>(classConstructor:
|
|
137
|
+
getComponents<T extends Component>(classConstructor: Constructor<T>): T[];
|
|
138
138
|
setParent(vfxItem: VFXItem): void;
|
|
139
139
|
/**
|
|
140
140
|
* 元素动画结束播放时回调函数
|