@galacean/effects-core 1.2.0 → 2.0.0-alpha.0
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-loader.d.ts +103 -0
- package/dist/asset-manager.d.ts +15 -1
- package/dist/asset-migrations.d.ts +2 -0
- package/dist/comp-vfx-item.d.ts +19 -63
- package/dist/components/component.d.ts +63 -0
- package/dist/components/effect-component.d.ts +63 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/renderer-component.d.ts +32 -0
- package/dist/composition-source-manager.d.ts +7 -6
- package/dist/composition.d.ts +40 -41
- package/dist/decorators.d.ts +4 -0
- package/dist/effects-object.d.ts +25 -0
- package/dist/engine.d.ts +23 -4
- package/dist/index.d.ts +25 -21
- package/dist/index.js +17265 -16811
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17230 -16783
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +5 -4
- package/dist/material/utils.d.ts +1 -1
- package/dist/pass-render-level.d.ts +1 -1
- package/dist/plugins/cal/animation-mixer-playable.d.ts +4 -0
- package/dist/plugins/cal/animation-playable-output.d.ts +4 -0
- package/dist/plugins/cal/animation-playable.d.ts +6 -0
- package/dist/plugins/cal/animation-stream.d.ts +14 -0
- package/dist/plugins/cal/calculate-item.d.ts +34 -57
- package/dist/plugins/cal/calculate-vfx-item.d.ts +71 -25
- package/dist/plugins/cal/playable-graph.d.ts +62 -0
- package/dist/plugins/cal/track.d.ts +35 -0
- package/dist/plugins/camera/camera-controller-node.d.ts +11 -8
- package/dist/plugins/index.d.ts +2 -5
- package/dist/plugins/interact/click-handler.d.ts +3 -3
- package/dist/plugins/interact/interact-item.d.ts +27 -1
- package/dist/plugins/interact/interact-loader.d.ts +0 -10
- package/dist/plugins/interact/interact-vfx-item.d.ts +7 -27
- package/dist/plugins/particle/particle-loader.d.ts +2 -11
- package/dist/plugins/particle/particle-mesh.d.ts +4 -9
- package/dist/plugins/particle/particle-system-renderer.d.ts +36 -0
- package/dist/plugins/particle/particle-system.d.ts +22 -21
- package/dist/plugins/particle/particle-vfx-item.d.ts +9 -25
- package/dist/plugins/particle/trail-mesh.d.ts +3 -5
- package/dist/plugins/sprite/sprite-item.d.ts +69 -42
- package/dist/plugins/sprite/sprite-loader.d.ts +3 -15
- package/dist/plugins/sprite/sprite-mesh.d.ts +4 -36
- package/dist/plugins/text/text-item.d.ts +12 -9
- package/dist/plugins/text/text-loader.d.ts +0 -15
- package/dist/render/geometry.d.ts +5 -14
- package/dist/render/mesh.d.ts +5 -16
- package/dist/render/render-frame.d.ts +3 -8
- package/dist/render/render-pass.d.ts +10 -9
- package/dist/render/renderer.d.ts +5 -5
- package/dist/render/shader.d.ts +7 -4
- package/dist/semantic-map.d.ts +1 -1
- package/dist/serialization-helper.d.ts +14 -0
- package/dist/texture/texture.d.ts +4 -4
- package/dist/transform.d.ts +14 -4
- package/dist/utils/asserts.d.ts +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/timeline-component.d.ts +1 -34
- package/dist/vfx-item.d.ts +56 -147
- package/package.json +3 -2
- package/dist/filter.d.ts +0 -63
- package/dist/filters/alpha-frame.d.ts +0 -5
- package/dist/filters/alpha-mask.d.ts +0 -5
- package/dist/filters/bloom.d.ts +0 -8
- package/dist/filters/camera-move.d.ts +0 -5
- package/dist/filters/delay.d.ts +0 -14
- package/dist/filters/distortion.d.ts +0 -5
- package/dist/filters/gaussian.d.ts +0 -27
- package/dist/filters/index.d.ts +0 -2
- package/dist/filters/lum.d.ts +0 -5
- package/dist/filters/utils.d.ts +0 -7
- package/dist/plugins/camera/camera-vfx-item.d.ts +0 -13
- package/dist/plugins/sprite/filter-sprite-vfx-item.d.ts +0 -13
- package/dist/plugins/sprite/sprite-group.d.ts +0 -95
- package/dist/plugins/sprite/sprite-vfx-item.d.ts +0 -33
- package/dist/plugins/text/text-mesh.d.ts +0 -15
- package/dist/plugins/text/text-vfx-item.d.ts +0 -28
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
|
|
2
|
+
import type { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
3
|
+
import type { Texture } from '../../texture';
|
|
4
|
+
import type { TrailMeshProps, TrailPointOptions } from './trail-mesh';
|
|
5
|
+
import type { ParticleMeshProps, Point } from './particle-mesh';
|
|
6
|
+
import { ParticleMesh } from './particle-mesh';
|
|
7
|
+
import type { Mesh, Renderer } from '../../render';
|
|
8
|
+
import type { Engine } from '../../engine';
|
|
9
|
+
import { RendererComponent } from '../../components';
|
|
10
|
+
/**
|
|
11
|
+
* @since 2.0.0
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare class ParticleSystemRenderer extends RendererComponent {
|
|
15
|
+
meshes: Mesh[];
|
|
16
|
+
particleMesh: ParticleMesh;
|
|
17
|
+
private trailMesh?;
|
|
18
|
+
constructor(engine: Engine, particleMeshProps: ParticleMeshProps, trailMeshProps?: TrailMeshProps);
|
|
19
|
+
start(): void;
|
|
20
|
+
update(dt: number): void;
|
|
21
|
+
render(renderer: Renderer): void;
|
|
22
|
+
reset(): void;
|
|
23
|
+
updateTime(now: number, delta: number): void;
|
|
24
|
+
minusTimeForLoop(duration: number): void;
|
|
25
|
+
updateWorldMatrix(worldMatrix: Matrix4): void;
|
|
26
|
+
setVisible(visible: boolean): void;
|
|
27
|
+
getTextures(): Texture[];
|
|
28
|
+
setParticlePoint(index: number, point: Point): void;
|
|
29
|
+
removeParticlePoint(index: number): void;
|
|
30
|
+
getParticlePointColor(index: number): number[];
|
|
31
|
+
hasTrail(): boolean;
|
|
32
|
+
clearTrail(pointIndex: number): void;
|
|
33
|
+
addTrailPoint(index: number, position: Vector3, options: TrailPointOptions): void;
|
|
34
|
+
setTrailStartPosition(index: number, position: Vector3): void;
|
|
35
|
+
getTrailStartPosition(index: number): Vector3;
|
|
36
|
+
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import * as spec from '@galacean/effects-specification';
|
|
2
|
-
import type { vec2, vec3, vec4 } from '@galacean/effects-specification';
|
|
3
1
|
import type { Ray } from '@galacean/effects-math/es/core/index';
|
|
4
2
|
import { Vector3 } from '@galacean/effects-math/es/core/index';
|
|
3
|
+
import type { vec2, vec3, vec4 } from '@galacean/effects-specification';
|
|
4
|
+
import * as spec from '@galacean/effects-specification';
|
|
5
|
+
import { Component } from '../../components';
|
|
6
|
+
import type { Engine } from '../../engine';
|
|
5
7
|
import type { ValueGetter } from '../../math';
|
|
8
|
+
import type { Mesh } from '../../render';
|
|
6
9
|
import type { ShapeGenerator } from '../../shape';
|
|
7
10
|
import { Texture } from '../../texture';
|
|
8
11
|
import { Transform } from '../../transform';
|
|
9
|
-
import type
|
|
12
|
+
import { type color } from '../../utils';
|
|
13
|
+
import type { BoundingBoxSphere, HitTestCustomParams } from '../interact/click-handler';
|
|
10
14
|
import { Burst } from './burst';
|
|
11
|
-
import type { ParticleVFXItem } from './particle-vfx-item';
|
|
12
|
-
import { TrailMesh } from './trail-mesh';
|
|
13
15
|
import type { Point } from './particle-mesh';
|
|
14
|
-
import {
|
|
15
|
-
import type { Mesh } from '../../render';
|
|
16
|
+
import { ParticleSystemRenderer } from './particle-system-renderer';
|
|
16
17
|
type ParticleSystemRayCastOptions = {
|
|
17
18
|
ray: Ray;
|
|
18
19
|
radius: number;
|
|
@@ -43,12 +44,10 @@ type ParticleOptions = {
|
|
|
43
44
|
turbulenceY: ValueGetter<number>,
|
|
44
45
|
turbulenceZ: ValueGetter<number>
|
|
45
46
|
];
|
|
46
|
-
duration: number;
|
|
47
47
|
looping: boolean;
|
|
48
48
|
maxCount: number;
|
|
49
49
|
gravity: vec3;
|
|
50
50
|
gravityModifier: ValueGetter<number>;
|
|
51
|
-
endBehavior: number;
|
|
52
51
|
renderLevel?: string;
|
|
53
52
|
particleFollowParent?: boolean;
|
|
54
53
|
forceTarget?: {
|
|
@@ -118,10 +117,10 @@ interface ParticleSystemOptions extends spec.ParticleOptions {
|
|
|
118
117
|
}
|
|
119
118
|
export interface ParticleSystemProps extends Omit<spec.ParticleContent, 'options' | 'renderer' | 'trails'> {
|
|
120
119
|
options: ParticleSystemOptions;
|
|
121
|
-
renderer:
|
|
120
|
+
renderer: ParticleSystemRendererOptions;
|
|
122
121
|
trails?: ParticleTrailProps;
|
|
123
122
|
}
|
|
124
|
-
export interface
|
|
123
|
+
export interface ParticleSystemRendererOptions extends Required<Omit<spec.RendererOptions, 'texture' | 'anchor' | 'particleOrigin'>> {
|
|
125
124
|
mask: number;
|
|
126
125
|
texture: Texture;
|
|
127
126
|
anchor?: vec2;
|
|
@@ -132,10 +131,8 @@ export interface ParticleTrailProps extends Omit<spec.ParticleTrail, 'texture'>
|
|
|
132
131
|
textureMap: vec4;
|
|
133
132
|
}
|
|
134
133
|
export type ParticleContent = [number, number, number, Point];
|
|
135
|
-
export declare class ParticleSystem {
|
|
136
|
-
|
|
137
|
-
particleMesh: ParticleMesh;
|
|
138
|
-
trailMesh?: TrailMesh;
|
|
134
|
+
export declare class ParticleSystem extends Component {
|
|
135
|
+
renderer: ParticleSystemRenderer;
|
|
139
136
|
options: ParticleOptions;
|
|
140
137
|
shape: ShapeGenerator;
|
|
141
138
|
emission: ParticleEmissionOptions;
|
|
@@ -144,7 +141,8 @@ export declare class ParticleSystem {
|
|
|
144
141
|
textureSheetAnimation?: ParticleTextureSheetAnimation;
|
|
145
142
|
interaction?: ParticleInteraction;
|
|
146
143
|
emissionStopped: boolean;
|
|
147
|
-
|
|
144
|
+
destoryed: boolean;
|
|
145
|
+
props: ParticleSystemProps;
|
|
148
146
|
private generatedCount;
|
|
149
147
|
private lastUpdate;
|
|
150
148
|
private loopStartTime;
|
|
@@ -155,14 +153,12 @@ export declare class ParticleSystem {
|
|
|
155
153
|
private frozen;
|
|
156
154
|
private upDirectionWorld;
|
|
157
155
|
private uvs;
|
|
158
|
-
private
|
|
159
|
-
|
|
160
|
-
constructor(props: ParticleSystemProps, rendererOptions: {
|
|
161
|
-
cachePrefix: string;
|
|
162
|
-
}, vfxItem: ParticleVFXItem);
|
|
156
|
+
private basicTransform;
|
|
157
|
+
constructor(engine: Engine, props?: ParticleSystemProps);
|
|
163
158
|
get timePassed(): number;
|
|
164
159
|
get lifetime(): number;
|
|
165
160
|
get particleCount(): number;
|
|
161
|
+
initEmitterTransform(): void;
|
|
166
162
|
private updateEmitterTransform;
|
|
167
163
|
private addParticle;
|
|
168
164
|
setVisible(visible: boolean): void;
|
|
@@ -192,5 +188,10 @@ export declare class ParticleSystem {
|
|
|
192
188
|
addBurst(burst: Burst, offsets: vec3[]): number;
|
|
193
189
|
removeBurst(index: number): void;
|
|
194
190
|
createPoint(lifetime: number): Point;
|
|
191
|
+
stopParticleEmission(): void;
|
|
192
|
+
resumeParticleEmission(): void;
|
|
193
|
+
getBoundingBox(): void | BoundingBoxSphere;
|
|
194
|
+
getHitTestParams: (force?: boolean) => void | HitTestCustomParams;
|
|
195
|
+
fromData(data: any): void;
|
|
195
196
|
}
|
|
196
197
|
export {};
|
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { Composition } from '../../composition';
|
|
3
|
-
import { VFXItem } from '../../vfx-item';
|
|
4
|
-
import type { BoundingBoxSphere, HitTestCustomParams } from '../interact/click-handler';
|
|
5
|
-
import type { ParticleSystemProps } from './particle-system';
|
|
1
|
+
import { Playable } from '../cal/playable-graph';
|
|
6
2
|
import { ParticleSystem } from './particle-system';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
onItemRemoved(composition: Composition, content: ParticleSystem): void;
|
|
16
|
-
/**
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
setColor(r: number, g: number, b: number, a: number): void;
|
|
20
|
-
setOpacity(opacity: number): void;
|
|
21
|
-
stopParticleEmission(): void;
|
|
22
|
-
resumeParticleEmission(): void;
|
|
23
|
-
protected doCreateContent(composition: Composition): ParticleSystem;
|
|
24
|
-
isEnded(now: number): boolean;
|
|
25
|
-
getBoundingBox(): void | BoundingBoxSphere;
|
|
26
|
-
getHitTestParams(force?: boolean): void | HitTestCustomParams;
|
|
3
|
+
/**
|
|
4
|
+
* @since 2.0.0
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class ParticleBehaviourPlayable extends Playable {
|
|
8
|
+
particleSystem: ParticleSystem;
|
|
9
|
+
onPlayablePlay(): void;
|
|
10
|
+
processFrame(dt: number): void;
|
|
27
11
|
}
|
|
@@ -7,7 +7,7 @@ import { Geometry, Mesh } from '../../render';
|
|
|
7
7
|
import { Texture } from '../../texture';
|
|
8
8
|
import type { Engine } from '../../engine';
|
|
9
9
|
import type { ValueGetter } from '../../math';
|
|
10
|
-
export type
|
|
10
|
+
export type TrailMeshProps = {
|
|
11
11
|
maxTrailCount: number;
|
|
12
12
|
pointCountPerTrail: number;
|
|
13
13
|
colorOverLifetime?: Array<GradientStop>;
|
|
@@ -16,7 +16,6 @@ export type TrailMeshConstructor = {
|
|
|
16
16
|
blending: number;
|
|
17
17
|
widthOverTrail: ValueGetter<number>;
|
|
18
18
|
colorOverTrail?: Array<GradientStop>;
|
|
19
|
-
order: number;
|
|
20
19
|
matrix?: Matrix4;
|
|
21
20
|
opacityOverLifetime: ValueGetter<number>;
|
|
22
21
|
occlusion: boolean;
|
|
@@ -28,7 +27,7 @@ export type TrailMeshConstructor = {
|
|
|
28
27
|
textureMap: vec4;
|
|
29
28
|
name: string;
|
|
30
29
|
};
|
|
31
|
-
type TrailPointOptions = {
|
|
30
|
+
export type TrailPointOptions = {
|
|
32
31
|
lifetime: number;
|
|
33
32
|
color: number[];
|
|
34
33
|
size: number;
|
|
@@ -45,7 +44,7 @@ export declare class TrailMesh {
|
|
|
45
44
|
checkVertexDistance: boolean;
|
|
46
45
|
private pointStart;
|
|
47
46
|
private trailCursors;
|
|
48
|
-
constructor(
|
|
47
|
+
constructor(engine: Engine, props: TrailMeshProps);
|
|
49
48
|
get time(): number;
|
|
50
49
|
set time(t: number);
|
|
51
50
|
addPoint(trailIndex: number, position: Vector3, opt: TrailPointOptions): void;
|
|
@@ -58,4 +57,3 @@ export declare class TrailMesh {
|
|
|
58
57
|
onUpdate(escapeTime: number): any;
|
|
59
58
|
}
|
|
60
59
|
export declare function getTrailMeshShader(trails: spec.ParticleTrail, particleMaxCount: number, name: string, env: string | undefined, gpuCapability: GPUCapability): ShaderWithSource;
|
|
61
|
-
export {};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Matrix4 } from '@galacean/effects-math/es/core/index';
|
|
2
|
+
import type { vec2, vec4 } from '@galacean/effects-specification';
|
|
2
3
|
import * as spec from '@galacean/effects-specification';
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
4
|
+
import { RendererComponent } from '../../components/renderer-component';
|
|
5
|
+
import type { Engine } from '../../engine';
|
|
6
|
+
import { Material } from '../../material';
|
|
5
7
|
import type { ValueGetter } from '../../math';
|
|
8
|
+
import type { Renderer } from '../../render';
|
|
9
|
+
import { Geometry } from '../../render';
|
|
6
10
|
import type { GeometryFromShape } from '../../shape';
|
|
7
11
|
import type { Texture } from '../../texture';
|
|
8
12
|
import type { CalculateItemOptions } from '../cal/calculate-item';
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import type {
|
|
13
|
+
import { TimelineComponent } from '../cal/calculate-item';
|
|
14
|
+
import { Playable } from '../cal/playable-graph';
|
|
15
|
+
import type { BoundingBoxTriangle, HitTestTriangleParams } from '../interact/click-handler';
|
|
12
16
|
/**
|
|
13
17
|
* 用于创建 spriteItem 的数据类型, 经过处理后的 spec.SpriteContent
|
|
14
18
|
*/
|
|
@@ -52,55 +56,78 @@ export interface SpriteItemRenderInfo {
|
|
|
52
56
|
mask: number;
|
|
53
57
|
maskMode: number;
|
|
54
58
|
cacheId: string;
|
|
55
|
-
filter?: FilterDefine;
|
|
56
59
|
wireframe?: boolean;
|
|
57
60
|
}
|
|
58
61
|
export type splitsDataType = [r: number, x: number, y: number, w: number, h: number | undefined][];
|
|
59
|
-
export declare class
|
|
60
|
-
|
|
62
|
+
export declare class SpriteColorPlayable extends Playable {
|
|
63
|
+
clipData: {
|
|
64
|
+
colorOverLifetime?: spec.ColorOverLifetime;
|
|
65
|
+
startColor?: spec.RGBAColorValue;
|
|
66
|
+
};
|
|
67
|
+
colorOverLifetime: {
|
|
68
|
+
stop: number;
|
|
69
|
+
color: any;
|
|
70
|
+
}[];
|
|
71
|
+
opacityOverLifetime: ValueGetter<number>;
|
|
72
|
+
startColor: spec.RGBAColorValue;
|
|
73
|
+
renderColor: vec4;
|
|
74
|
+
spriteMaterial: Material;
|
|
75
|
+
onPlayablePlay(): void;
|
|
76
|
+
processFrame(dt: number): void;
|
|
77
|
+
fromData(clipData: {
|
|
78
|
+
colorOverLifetime?: spec.ColorOverLifetime;
|
|
79
|
+
startColor?: spec.RGBAColorValue;
|
|
80
|
+
}): this;
|
|
81
|
+
}
|
|
82
|
+
export declare class SpriteComponent extends RendererComponent {
|
|
61
83
|
renderer: SpriteItemRenderer;
|
|
62
84
|
interaction?: {
|
|
63
85
|
behavior: spec.InteractBehavior;
|
|
64
|
-
}
|
|
65
|
-
listIndex: number;
|
|
66
|
-
parentId?: string;
|
|
67
|
-
reusable: boolean;
|
|
86
|
+
};
|
|
68
87
|
cachePrefix: string;
|
|
69
88
|
geoData: {
|
|
70
|
-
|
|
71
|
-
index: number[] | TypedArray;
|
|
89
|
+
atlasOffset: number[] | spec.TypedArray;
|
|
90
|
+
index: number[] | spec.TypedArray;
|
|
72
91
|
};
|
|
73
|
-
mesh?: SpriteMesh;
|
|
74
92
|
anchor?: vec2;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
private _filter?;
|
|
93
|
+
timelineComponent: TimelineComponent;
|
|
94
|
+
textureSheetAnimation?: spec.TextureSheetAnimation;
|
|
95
|
+
splits: splitsDataType;
|
|
96
|
+
emptyTexture: Texture;
|
|
97
|
+
color: vec4;
|
|
98
|
+
worldMatrix: Matrix4;
|
|
99
|
+
geometry: Geometry;
|
|
83
100
|
/***********************/
|
|
84
|
-
private
|
|
85
|
-
private readonly
|
|
86
|
-
private
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}, vfxItem: SpriteVFXItem);
|
|
90
|
-
get filter(): FilterDefine | undefined;
|
|
91
|
-
set filter(f: FilterDefine | undefined);
|
|
92
|
-
get renderInfo(): SpriteItemRenderInfo;
|
|
93
|
-
initTexture(texture: Texture, emptyTexture: Texture): Texture;
|
|
94
|
-
getTextures(): Texture[];
|
|
101
|
+
private renderInfo;
|
|
102
|
+
private readonly wireframe?;
|
|
103
|
+
private preMultiAlpha;
|
|
104
|
+
private visible;
|
|
105
|
+
constructor(engine: Engine, props?: SpriteItemProps);
|
|
95
106
|
/**
|
|
96
|
-
*
|
|
107
|
+
* 设置当前 Mesh 的可见性。
|
|
108
|
+
* @param visible - true:可见,false:不可见
|
|
97
109
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
setVisible(visible: boolean): void;
|
|
111
|
+
/**
|
|
112
|
+
* 获取当前 Mesh 的可见性。
|
|
113
|
+
*/
|
|
114
|
+
getVisible(): boolean;
|
|
115
|
+
render(renderer: Renderer): void;
|
|
116
|
+
start(): void;
|
|
117
|
+
update(dt: number): void;
|
|
118
|
+
onDestroy(): void;
|
|
119
|
+
private getItemInitData;
|
|
120
|
+
private setItem;
|
|
121
|
+
private createGeometry;
|
|
122
|
+
private createMaterial;
|
|
123
|
+
private getItemGeometryData;
|
|
124
|
+
getTextures(): Texture[];
|
|
100
125
|
/**
|
|
101
|
-
*
|
|
126
|
+
* 获取图层包围盒的类型和世界坐标
|
|
127
|
+
* @returns
|
|
102
128
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
129
|
+
getBoundingBox(): BoundingBoxTriangle | void;
|
|
130
|
+
getHitTestParams: (force?: boolean) => HitTestTriangleParams | void;
|
|
131
|
+
fromData(data: SpriteItemProps): void;
|
|
132
|
+
toData(): void;
|
|
106
133
|
}
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import * as spec from '@galacean/effects-specification';
|
|
2
|
-
import type { Composition } from '../../composition';
|
|
3
|
-
import type { SpriteItem } from '../index';
|
|
4
|
-
import { AbstractPlugin } from '../index';
|
|
5
|
-
import { type VFXItem } from '../../vfx-item';
|
|
6
|
-
import type { LayerInfo } from './sprite-group';
|
|
7
|
-
import type { RenderFrame, Renderer } from '../../render';
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
8
2
|
import type { PrecompileOptions } from '../../plugin-system';
|
|
3
|
+
import type { Renderer } from '../../render';
|
|
4
|
+
import { AbstractPlugin } from '../index';
|
|
9
5
|
export declare class SpriteLoader extends AbstractPlugin {
|
|
10
|
-
layerInfo?: LayerInfo;
|
|
11
6
|
name: string;
|
|
12
7
|
static precompile(compositions: spec.Composition[], render: Renderer, options?: PrecompileOptions): Promise<any>;
|
|
13
|
-
onCompositionDestroyed(composition: Composition): void;
|
|
14
|
-
onCompositionReset(composition: Composition, pipeline: RenderFrame): void;
|
|
15
|
-
onCompositionItemLifeBegin(composition: Composition, item: VFXItem<SpriteItem>): void;
|
|
16
|
-
onCompositionItemRemoved(composition: Composition, item: VFXItem<SpriteItem>): void;
|
|
17
|
-
onCompositionUpdate(composition: Composition, dt: number): void;
|
|
18
|
-
prepareRenderFrame(composition: Composition, renderFrame: RenderFrame): boolean;
|
|
19
|
-
postProcessFrame(composition: Composition, pipeline: RenderFrame): void;
|
|
20
8
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
+
import type { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
1
2
|
import type * as spec from '@galacean/effects-specification';
|
|
2
|
-
import { Vector3 } from '@galacean/effects-math/es/core/index';
|
|
3
|
-
import type { Composition } from '../../composition';
|
|
4
|
-
import type { FilterShaderDefine } from '../../filter';
|
|
5
3
|
import type { GPUCapabilityDetail, SharedShaderWithSource } from '../../render';
|
|
6
|
-
import { Mesh } from '../../render';
|
|
7
4
|
import type { Transform } from '../../transform';
|
|
8
|
-
import type {
|
|
9
|
-
import type { Engine } from '../../engine';
|
|
5
|
+
import type { SpriteComponent, SpriteItemRenderInfo } from './sprite-item';
|
|
10
6
|
export type SpriteRenderData = {
|
|
11
7
|
life: number;
|
|
12
8
|
transform: Transform;
|
|
@@ -25,37 +21,9 @@ export type SpriteRegionData = {
|
|
|
25
21
|
};
|
|
26
22
|
export declare let maxSpriteMeshItemCount: number;
|
|
27
23
|
export declare let maxSpriteTextureCount: number;
|
|
28
|
-
export declare class SpriteMesh {
|
|
29
|
-
engine: Engine;
|
|
30
|
-
private readonly composition;
|
|
31
|
-
items: SpriteItem[];
|
|
32
|
-
splitLayer: boolean;
|
|
33
|
-
readonly mesh: Mesh;
|
|
34
|
-
protected readonly lineMode: boolean;
|
|
35
|
-
private readonly wireframe?;
|
|
36
|
-
private dirty;
|
|
37
|
-
private preMultiAlpha;
|
|
38
|
-
private mtlSlotCount;
|
|
39
|
-
constructor(engine: Engine, renderInfo: SpriteItemRenderInfo, composition: Composition);
|
|
40
|
-
setItems(items: SpriteItem[]): true | undefined;
|
|
41
|
-
updateItem(item: SpriteItem, init?: boolean): void;
|
|
42
|
-
applyChange(): void;
|
|
43
|
-
getItemInitData(item: SpriteItem, idx: number, pointStartIndex: number, textureIndex: number): {
|
|
44
|
-
aPoint: spec.TypedArray | number[];
|
|
45
|
-
index: number[];
|
|
46
|
-
};
|
|
47
|
-
getItemRegionData(item: SpriteItem): SpriteRegionData | void;
|
|
48
|
-
invalidMaterial(): void;
|
|
49
|
-
private createGeometry;
|
|
50
|
-
private createMaterial;
|
|
51
|
-
getItemGeometryData(item: SpriteItem, aIndex: number): {
|
|
52
|
-
index: Uint16Array | number[];
|
|
53
|
-
aPoint: number[];
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
24
|
export declare function setSpriteMeshMaxItemCountByGPU(gpuCapability: GPUCapabilityDetail): 16 | 32 | undefined;
|
|
57
|
-
export declare function getImageItemRenderInfo(item:
|
|
58
|
-
export declare function spriteMeshShaderFromFilter(level: number,
|
|
25
|
+
export declare function getImageItemRenderInfo(item: SpriteComponent): SpriteItemRenderInfo;
|
|
26
|
+
export declare function spriteMeshShaderFromFilter(level: number, options?: {
|
|
59
27
|
count?: number;
|
|
60
28
|
ignoreBlend?: boolean;
|
|
61
29
|
wireframe?: boolean;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import * as spec from '@galacean/effects-specification';
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
5
|
-
import { TextStyle } from './text-style';
|
|
2
|
+
import type { Engine } from '../../engine';
|
|
3
|
+
import type { SpriteItemProps } from '../sprite/sprite-item';
|
|
4
|
+
import { SpriteComponent } from '../sprite/sprite-item';
|
|
6
5
|
import { TextLayout } from './text-layout';
|
|
7
|
-
|
|
6
|
+
import { TextStyle } from './text-style';
|
|
7
|
+
/**
|
|
8
|
+
* @since 2.0.0
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare class TextComponent extends SpriteComponent {
|
|
8
12
|
textStyle: TextStyle;
|
|
9
13
|
isDirty: boolean;
|
|
10
14
|
canvas: HTMLCanvasElement;
|
|
11
15
|
context: CanvasRenderingContext2D | null;
|
|
12
16
|
textLayout: TextLayout;
|
|
13
17
|
text: string;
|
|
14
|
-
private engine;
|
|
15
18
|
private char;
|
|
16
|
-
constructor(
|
|
17
|
-
emptyTexture: Texture;
|
|
18
|
-
}, vfxItem: TextVFXItem);
|
|
19
|
+
constructor(engine: Engine, props?: spec.TextContent);
|
|
19
20
|
/**
|
|
20
21
|
* 设置字号大小
|
|
21
22
|
* @param value - 字号
|
|
@@ -106,11 +107,13 @@ export declare class TextItem extends SpriteItem {
|
|
|
106
107
|
* @returns
|
|
107
108
|
*/
|
|
108
109
|
setFontScale(value: number): void;
|
|
110
|
+
update(dt: number): void;
|
|
109
111
|
/**
|
|
110
112
|
* 更新文本
|
|
111
113
|
* @returns
|
|
112
114
|
*/
|
|
113
115
|
updateTexture(): void;
|
|
116
|
+
fromData(data: SpriteItemProps): void;
|
|
114
117
|
private getFontDesc;
|
|
115
118
|
private setupOutline;
|
|
116
119
|
private setupShadow;
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
import type { Composition } from '../../composition';
|
|
2
1
|
import { AbstractPlugin } from '../index';
|
|
3
|
-
import type { VFXItem } from '../../vfx-item';
|
|
4
|
-
import type { Mesh, RenderFrame } from '../../render';
|
|
5
|
-
import type { TextItem } from './text-item';
|
|
6
|
-
import { TextVFXItem } from './text-vfx-item';
|
|
7
2
|
export declare class TextLoader extends AbstractPlugin {
|
|
8
|
-
name: string;
|
|
9
|
-
addItems: TextVFXItem[];
|
|
10
|
-
removeItems: TextVFXItem[];
|
|
11
|
-
readonly meshes: Mesh[];
|
|
12
|
-
onCompositionDestroyed(composition: Composition): void;
|
|
13
|
-
onCompositionUpdate(composition: Composition, dt: number): void;
|
|
14
|
-
onCompositionItemLifeBegin(composition: Composition, item: VFXItem<TextItem>): void;
|
|
15
|
-
onCompositionReset(composition: Composition, pipeline: RenderFrame): void;
|
|
16
|
-
onCompositionItemRemoved(composition: Composition, item: VFXItem<TextItem>): void;
|
|
17
|
-
prepareRenderFrame(composition: Composition, renderFrame: RenderFrame): boolean;
|
|
18
3
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
|
-
import type { Disposable } from '../utils';
|
|
3
2
|
import type { Engine } from '../engine';
|
|
3
|
+
import { EffectsObject } from '../effects-object';
|
|
4
4
|
export declare const BYTES_TYPE_MAP: Record<string, number>;
|
|
5
5
|
/**
|
|
6
6
|
* Geometry 的绘制模式
|
|
@@ -27,20 +27,15 @@ export interface GeometryProps {
|
|
|
27
27
|
/**
|
|
28
28
|
* Geometry 抽象类
|
|
29
29
|
*/
|
|
30
|
-
export declare abstract class Geometry
|
|
30
|
+
export declare abstract class Geometry extends EffectsObject {
|
|
31
31
|
/**
|
|
32
32
|
* Geometry 的名称
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
name: string;
|
|
35
35
|
/**
|
|
36
36
|
* Geometry 创建函数
|
|
37
|
-
* @param name - 名称
|
|
38
37
|
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Geometry 创建函数
|
|
42
|
-
*/
|
|
43
|
-
static create: (engine: Engine, opts: GeometryProps) => Geometry;
|
|
38
|
+
static create: (engine: Engine, opts?: GeometryProps) => Geometry;
|
|
44
39
|
/**
|
|
45
40
|
* 获取 Geometry 的 attribute 数据。
|
|
46
41
|
* @param name - attribute 名称
|
|
@@ -76,7 +71,7 @@ export declare abstract class Geometry implements Disposable {
|
|
|
76
71
|
* 设置 Geometry 的 indices 数据。
|
|
77
72
|
* @param data - 要设置的 indices 数据
|
|
78
73
|
*/
|
|
79
|
-
abstract setIndexData(data
|
|
74
|
+
abstract setIndexData(data: spec.TypedArray): void;
|
|
80
75
|
/**
|
|
81
76
|
* 设置 indices 的部分数据,当 indices 数据只有部分更新时,可调用此函数。
|
|
82
77
|
* @param offset - 更新数据在 indices 数组的起始位置 index
|
|
@@ -101,10 +96,6 @@ export declare abstract class Geometry implements Disposable {
|
|
|
101
96
|
* 获取当前 Geometry 的 drawcount
|
|
102
97
|
*/
|
|
103
98
|
abstract getDrawCount(): number;
|
|
104
|
-
/**
|
|
105
|
-
* 销毁当前资源
|
|
106
|
-
*/
|
|
107
|
-
abstract dispose(): void;
|
|
108
99
|
/**
|
|
109
100
|
* 初始化 GPU 资源
|
|
110
101
|
* @override
|
package/dist/render/mesh.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Material, MaterialDestroyOptions } from '../material';
|
|
|
4
4
|
import type { Geometry, Renderer } from '../render';
|
|
5
5
|
import type { Disposable } from '../utils';
|
|
6
6
|
import { DestroyOptions } from '../utils';
|
|
7
|
+
import { RendererComponent } from '../components/renderer-component';
|
|
7
8
|
export interface MeshOptionsBase {
|
|
8
9
|
material: Material;
|
|
9
10
|
name?: string;
|
|
@@ -20,49 +21,37 @@ export interface MeshDestroyOptions {
|
|
|
20
21
|
/**
|
|
21
22
|
* Mesh 抽象类
|
|
22
23
|
*/
|
|
23
|
-
export declare class Mesh implements Disposable {
|
|
24
|
-
private engine;
|
|
24
|
+
export declare class Mesh extends RendererComponent implements Disposable {
|
|
25
25
|
/**
|
|
26
26
|
* Mesh 的全局唯一 id
|
|
27
27
|
*/
|
|
28
28
|
readonly id: string;
|
|
29
|
-
/**
|
|
30
|
-
* Mesh 名称,缺省是 \<unnamed>
|
|
31
|
-
*/
|
|
32
|
-
readonly name: string;
|
|
33
29
|
/**
|
|
34
30
|
* Mesh 的世界矩阵
|
|
35
31
|
*/
|
|
36
32
|
worldMatrix: Matrix4;
|
|
37
|
-
/**
|
|
38
|
-
* Mesh 的材质
|
|
39
|
-
*/
|
|
40
|
-
material: Material;
|
|
41
33
|
/**
|
|
42
34
|
* Mesh 的 Geometry
|
|
43
35
|
*/
|
|
44
36
|
geometry: Geometry;
|
|
45
37
|
protected destroyed: boolean;
|
|
46
|
-
private _priority;
|
|
47
38
|
private visible;
|
|
48
39
|
/**
|
|
49
40
|
* 创建一个新的 Mesh 对象。
|
|
50
41
|
*/
|
|
51
|
-
static create: (engine: Engine, props
|
|
52
|
-
constructor(engine: Engine, props
|
|
53
|
-
get priority(): number;
|
|
54
|
-
set priority(value: number);
|
|
42
|
+
static create: (engine: Engine, props?: GeometryMeshProps) => Mesh;
|
|
43
|
+
constructor(engine: Engine, props?: GeometryMeshProps);
|
|
55
44
|
get isDestroyed(): boolean;
|
|
56
45
|
/**
|
|
57
46
|
* 设置当前 Mesh 的可见性。
|
|
58
47
|
* @param visible - true:可见,false:不可见
|
|
59
48
|
*/
|
|
60
49
|
setVisible(visible: boolean): void;
|
|
61
|
-
render(renderer: Renderer): void;
|
|
62
50
|
/**
|
|
63
51
|
* 获取当前 Mesh 的可见性。
|
|
64
52
|
*/
|
|
65
53
|
getVisible(): boolean;
|
|
54
|
+
render(renderer: Renderer): void;
|
|
66
55
|
/**
|
|
67
56
|
* 获取当前 Mesh 的第一个 geometry。
|
|
68
57
|
*/
|
|
@@ -14,6 +14,7 @@ import type { RenderPassClearAction, RenderPassColorAttachmentOptions, RenderPas
|
|
|
14
14
|
import { RenderPass } from './render-pass';
|
|
15
15
|
import type { Renderer } from './renderer';
|
|
16
16
|
import type { GlobalVolume } from './global-volume';
|
|
17
|
+
import type { RendererComponent } from '../components';
|
|
17
18
|
/**
|
|
18
19
|
* 渲染数据,保存了当前渲染使用到的数据。
|
|
19
20
|
*/
|
|
@@ -169,6 +170,7 @@ export declare class RenderFrame implements Disposable {
|
|
|
169
170
|
resource: RenderFrameResource;
|
|
170
171
|
keepColorBuffer?: boolean;
|
|
171
172
|
editorTransform: Vector4;
|
|
173
|
+
renderQueue: RendererComponent[];
|
|
172
174
|
/**
|
|
173
175
|
* 名称
|
|
174
176
|
*/
|
|
@@ -195,19 +197,13 @@ export declare class RenderFrame implements Disposable {
|
|
|
195
197
|
* 根据 Mesh 优先级添加到 RenderPass
|
|
196
198
|
* @param mesh - 要添加的 Mesh 对象
|
|
197
199
|
*/
|
|
198
|
-
addMeshToDefaultRenderPass(mesh
|
|
200
|
+
addMeshToDefaultRenderPass(mesh?: RendererComponent): void;
|
|
199
201
|
/**
|
|
200
202
|
* 把 Mesh 从 RenderPass 中移除,
|
|
201
203
|
* 如果 renderPass 中没有 mesh,此 renderPass 会被删除
|
|
202
204
|
* @param mesh - 要删除的 Mesh 对象
|
|
203
205
|
*/
|
|
204
206
|
removeMeshFromDefaultRenderPass(mesh: Mesh): void;
|
|
205
|
-
/**
|
|
206
|
-
* 将 Mesh 所有在 RenderPass 进行切分
|
|
207
|
-
* @param mesh - 目标 Mesh 对象
|
|
208
|
-
* @param options - 切分选项,包含 RenderPass 相关的 Attachment 等数据
|
|
209
|
-
*/
|
|
210
|
-
splitDefaultRenderPassByMesh(mesh: Mesh, options: RenderPassSplitOptions): RenderPass;
|
|
211
207
|
/**
|
|
212
208
|
* 销毁 RenderFrame
|
|
213
209
|
* @param options - 可以有选择销毁一些对象
|
|
@@ -227,7 +223,6 @@ export declare class RenderFrame implements Disposable {
|
|
|
227
223
|
protected addToRenderPass(renderPass: RenderPass, mesh: Mesh): void;
|
|
228
224
|
protected getRPAttachments(attachments: RenderPassColorAttachmentOptions[], preRP?: RenderPass): RenderPassColorAttachmentOptions[];
|
|
229
225
|
protected resetClearActions(): void;
|
|
230
|
-
protected updateRenderInfo(renderPass: RenderPass): RenderPassInfo;
|
|
231
226
|
/**
|
|
232
227
|
* 设置 RenderPass 数组,直接修改内部的 RenderPass 数组
|
|
233
228
|
* @param passes - RenderPass 数组
|