@galacean/effects-core 2.3.1 → 2.4.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.
@@ -2,3 +2,4 @@ export * from './types';
2
2
  export * from './utils';
3
3
  export * from './material-data-block';
4
4
  export * from './material';
5
+ export * from './mask-ref-manager';
@@ -0,0 +1,15 @@
1
+ import type { Engine } from '../engine';
2
+ import type { MaskProps } from './types';
3
+ import { MaskMode } from './types';
4
+ export declare class MaskRefManager {
5
+ currentRef: number;
6
+ constructor(initRef?: number);
7
+ distributeRef(): number;
8
+ }
9
+ export declare class MaskProcessor {
10
+ engine: Engine;
11
+ maskRef: number;
12
+ constructor(engine: Engine);
13
+ getRefValue(): number;
14
+ getMaskMode(data: MaskProps): MaskMode;
15
+ }
@@ -2,6 +2,7 @@ import type * as spec from '@galacean/effects-specification';
2
2
  import type { Matrix3, Matrix4, Vector2, Vector3, Vector4 } from '@galacean/effects-math/es/core/index';
3
3
  import type { Texture } from '../texture';
4
4
  import type { DestroyOptions } from '../utils';
5
+ import type { MaskProcessor } from './mask-ref-manager';
5
6
  export type UniformSemantic = 'VIEW' | 'MODEL' | 'MODELVIEW' | 'PROJECTION' | 'VIEWPROJECTION' | 'VIEWINVERSE' | 'EDITOR_TRANSFORM' | 'MODELVIEWPROJECTION';
6
7
  export interface MaterialBlendingStates {
7
8
  blending?: boolean;
@@ -59,3 +60,34 @@ export declare enum ShaderType {
59
60
  vertex = 0,
60
61
  fragment = 1
61
62
  }
63
+ export interface MaskProps {
64
+ mask?: {
65
+ mask?: boolean;
66
+ mode?: spec.ObscuredMode;
67
+ ref?: Maskable;
68
+ };
69
+ }
70
+ /**
71
+ *
72
+ */
73
+ export interface Maskable {
74
+ readonly maskManager: MaskProcessor;
75
+ }
76
+ export declare enum MaskMode {
77
+ /**
78
+ * 无
79
+ */
80
+ NONE = 0,
81
+ /**
82
+ * 蒙版
83
+ */
84
+ MASK = 1,
85
+ /**
86
+ * 被遮挡
87
+ */
88
+ OBSCURED = 2,
89
+ /**
90
+ * 被反向遮挡
91
+ */
92
+ REVERSE_OBSCURED = 3
93
+ }
@@ -1,7 +1,8 @@
1
1
  import * as spec from '@galacean/effects-specification';
2
+ import { MaskMode } from './types';
2
3
  import type { Material } from './material';
3
4
  export declare function valIfUndefined<T>(val: any, def: T): T;
4
5
  export declare function getPreMultiAlpha(blending?: number): number;
5
6
  export declare function setBlendMode(material: Material, blendMode?: number): void;
6
7
  export declare function setSideMode(material: Material, side: spec.SideMode): void;
7
- export declare function setMaskMode(material: Material, maskMode: spec.MaskMode): void;
8
+ export declare function setMaskMode(material: Material, maskMode: MaskMode, colorMask?: boolean): void;
@@ -19,5 +19,11 @@ export * from './particle/particle-system-renderer';
19
19
  export * from './cal/calculate-loader';
20
20
  export * from './cal/calculate-vfx-item';
21
21
  export * from './cal/calculate-item';
22
+ export * from './shape/build-line';
23
+ export * from './shape/graphics-path';
24
+ export * from './shape/ellipse';
25
+ export * from './shape/poly-star';
26
+ export * from './shape/polygon';
27
+ export * from './shape/shape-path';
22
28
  export * from './timeline';
23
29
  export * from './text';
@@ -6,6 +6,8 @@ import { Component } from '../../components';
6
6
  import type { Engine } from '../../engine';
7
7
  import type { ValueGetter } from '../../math';
8
8
  import type { Mesh } from '../../render';
9
+ import type { Maskable } from '../../material';
10
+ import { MaskMode, MaskProcessor } from '../../material';
9
11
  import type { ShapeGenerator, ShapeParticle } from '../../shape';
10
12
  import { Texture } from '../../texture';
11
13
  import { Transform } from '../../transform';
@@ -114,23 +116,30 @@ type ParticleInteraction = {
114
116
  export interface ParticleSystemOptions extends spec.ParticleOptions {
115
117
  meshSlots?: number[];
116
118
  }
117
- export interface ParticleSystemProps extends Omit<spec.ParticleContent, 'options' | 'renderer' | 'trails'> {
119
+ export interface ParticleSystemProps extends Omit<spec.ParticleContent, 'options' | 'renderer' | 'trails' | 'mask'> {
118
120
  options: ParticleSystemOptions;
119
121
  renderer: ParticleSystemRendererOptions;
120
122
  trails?: ParticleTrailProps;
123
+ mask?: {
124
+ mode: MaskMode;
125
+ ref: Maskable;
126
+ };
121
127
  }
122
128
  export interface ParticleSystemRendererOptions extends Required<Omit<spec.RendererOptions, 'texture' | 'anchor' | 'particleOrigin'>> {
123
- mask: number;
124
129
  texture: Texture;
125
130
  anchor?: vec2;
126
131
  particleOrigin?: spec.ParticleOrigin;
127
132
  }
128
- export interface ParticleTrailProps extends Omit<spec.ParticleTrail, 'texture'> {
133
+ export interface ParticleTrailProps extends Omit<spec.ParticleTrail, 'texture' | 'mask'> {
129
134
  texture: Texture;
130
135
  textureMap: vec4;
136
+ mask?: {
137
+ mode: MaskMode;
138
+ ref: Maskable;
139
+ };
131
140
  }
132
141
  export type ParticleContent = [number, number, number, Point];
133
- export declare class ParticleSystem extends Component {
142
+ export declare class ParticleSystem extends Component implements Maskable {
134
143
  renderer: ParticleSystemRenderer;
135
144
  options: ParticleOptions;
136
145
  shape: ShapeGenerator;
@@ -142,6 +151,7 @@ export declare class ParticleSystem extends Component {
142
151
  emissionStopped: boolean;
143
152
  destroyed: boolean;
144
153
  props: ParticleSystemProps;
154
+ readonly maskManager: MaskProcessor;
145
155
  private generatedCount;
146
156
  private lastUpdate;
147
157
  private loopStartTime;
@@ -207,5 +217,9 @@ export declare class ParticleSystem extends Component {
207
217
  getBoundingBox(): void | BoundingBoxSphere;
208
218
  getHitTestParams: (force?: boolean) => void | HitTestCustomParams;
209
219
  fromData(data: unknown): void;
220
+ getMaskOptions(data: ParticleSystemProps | ParticleTrailProps): {
221
+ maskMode: MaskMode;
222
+ maskRef: number;
223
+ };
210
224
  }
211
225
  export {};
@@ -1,20 +1,20 @@
1
1
  import * as spec from '@galacean/effects-specification';
2
+ import type { ColorPlayableAssetData } from '../../animation';
3
+ import { BaseRenderComponent } from '../../components';
2
4
  import type { Engine } from '../../engine';
5
+ import type { MaskProps } from '../../material';
3
6
  import type { GeometryDrawMode } from '../../render';
4
7
  import { Geometry } from '../../render';
5
8
  import type { GeometryFromShape } from '../../shape';
6
9
  import { type Texture } from '../../texture';
7
- import type { PlayableGraph, Playable } from '../cal/playable-graph';
10
+ import type { Playable, PlayableGraph } from '../cal/playable-graph';
8
11
  import { PlayableAsset } from '../cal/playable-graph';
9
- import type { ColorPlayableAssetData } from '../../animation';
10
- import { BaseRenderComponent } from '../../components/base-render-component';
11
12
  /**
12
13
  * 用于创建 spriteItem 的数据类型, 经过处理后的 spec.SpriteContent
13
14
  */
14
- export interface SpriteItemProps extends Omit<spec.SpriteContent, 'renderer'> {
15
+ export interface SpriteItemProps extends Omit<spec.SpriteContent, 'renderer' | 'mask'>, MaskProps {
15
16
  listIndex?: number;
16
17
  renderer: {
17
- mask: number;
18
18
  shape: GeometryFromShape;
19
19
  texture: Texture;
20
20
  } & Omit<spec.RendererOptions, 'texture'>;
@@ -1,19 +1,18 @@
1
1
  import * as spec from '@galacean/effects-specification';
2
+ import type { ItemRenderer } from '../../components';
3
+ import { BaseRenderComponent } from '../../components';
2
4
  import type { Engine } from '../../engine';
5
+ import type { MaskProps, Material } from '../../material';
3
6
  import { Texture } from '../../texture';
7
+ import type { VFXItem } from '../../vfx-item';
4
8
  import { TextLayout } from './text-layout';
5
9
  import { TextStyle } from './text-style';
6
- import type { Material } from '../../material';
7
- import type { VFXItem } from '../../vfx-item';
8
- import type { ItemRenderer } from '../../components';
9
- import { BaseRenderComponent } from '../../components';
10
10
  /**
11
11
  * 用于创建 textItem 的数据类型, 经过处理后的 spec.TextContentOptions
12
12
  */
13
- export interface TextItemProps extends Omit<spec.TextContent, 'renderer'> {
13
+ export interface TextItemProps extends Omit<spec.TextContent, 'renderer' | 'mask'>, MaskProps {
14
14
  listIndex?: number;
15
15
  renderer: {
16
- mask: number;
17
16
  texture: Texture;
18
17
  } & Omit<spec.RendererOptions, 'texture'>;
19
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-core",
3
- "version": "2.3.1",
3
+ "version": "2.4.0-alpha.0",
4
4
  "description": "Galacean Effects runtime core for the web",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -42,7 +42,7 @@
42
42
  "registry": "https://registry.npmjs.org"
43
43
  },
44
44
  "dependencies": {
45
- "@galacean/effects-specification": "2.2.0",
45
+ "@galacean/effects-specification": "2.3.0-alpha.0",
46
46
  "@galacean/effects-math": "1.1.0",
47
47
  "flatbuffers": "24.3.25",
48
48
  "uuid": "9.0.1",