@galacean/effects-core 2.0.0-alpha.32 → 2.0.0-alpha.34

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.
@@ -46,10 +46,6 @@ export interface MaterialProps {
46
46
  * uniform 数据
47
47
  */
48
48
  uniformValues?: Record<string, UniformValue>;
49
- transformFeedbackOutput?: {
50
- mode: WebGL2RenderingContext['INTERLEAVED_ATTRIBS'] | WebGL2RenderingContext['SEPARATE_ATTRIBS'];
51
- varyings: string[];
52
- };
53
49
  }
54
50
  /**
55
51
  * Material 抽象类
@@ -349,7 +345,7 @@ export declare abstract class Material extends EffectsObject implements Disposab
349
345
  * 销毁当前 Material
350
346
  * @param destroy - 包含纹理的销毁选项
351
347
  */
352
- abstract dispose(destroy?: MaterialDestroyOptions): void;
348
+ abstract dispose(destroy?: MaterialDestroyOptions | DestroyOptions): void;
353
349
  /**
354
350
  * 创建 Material
355
351
  */
@@ -1,17 +1,7 @@
1
1
  import * as spec from '@galacean/effects-specification';
2
- import type { ShaderMacros } from '../render';
3
2
  import type { Material } from './material';
4
- import { ShaderType } from './types';
5
3
  export declare function valIfUndefined<T>(val: any, def: T): T;
6
4
  export declare function getPreMultiAlpha(blending?: number): number;
7
- /**
8
- * 生成 shader,检测到 WebGL1 上下文会降级
9
- * @param macros - 宏定义数组
10
- * @param shader - 原始 shader 文本
11
- * @param shaderType - shader 类型
12
- * @return 去除版本号的 shader 文本
13
- */
14
- export declare function createShaderWithMacros(macros: ShaderMacros, shader: string, shaderType: ShaderType, level: number): string;
15
5
  export declare function setBlendMode(material: Material, blendMode?: number): void;
16
6
  export declare function setSideMode(material: Material, side: spec.SideMode): void;
17
7
  export declare function setMaskMode(material: Material, maskMode: spec.MaskMode): void;
@@ -6,8 +6,6 @@ import type { Camera } from '../camera';
6
6
  export type vec = number[];
7
7
  export declare function ensureVec3(num?: any): vec3;
8
8
  export declare function vecFill<T extends vec | vec3 | vec4 | vec2>(out: T | number[], number: number): T;
9
- export declare function vecAssign<T extends vec | vec3 | vec4 | vec2>(out: T | number[] | Float32Array, a: T, count: number, start?: number): T;
10
- export declare function vecNormalize<T extends vec | vec2 | vec3 | vec4>(out: T | number[], a?: T | number[]): T;
11
9
  export declare function vecMulCombine<T extends vec | vec3 | vec4 | vec2>(out: T | number[] | Float32Array, a?: T, b?: T): T;
12
10
  export declare const particleOriginTranslateMap: Record<number, vec2>;
13
11
  export declare function nearestPowerOfTwo(value: number): number;
@@ -15,4 +13,3 @@ export declare function setRayFromCamera(x: number, y: number, camera: Camera):
15
13
  export declare function trianglesFromRect(position: Vector3, halfWidth: number, halfHeight: number): TriangleLike[];
16
14
  export declare function decimalEqual(a: number, b: number, epsilon?: number): boolean;
17
15
  export declare function numberToFix(a: number, fixed?: number): number;
18
- export declare function pointOnLine(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): boolean;
@@ -1,6 +1,12 @@
1
+ import { ValueGetter } from '../../math';
2
+ interface BurstOptions {
3
+ time: number;
4
+ interval: number;
5
+ count: number | ValueGetter<number>;
6
+ cycles: number;
7
+ probability: number;
8
+ }
1
9
  export declare class Burst {
2
- once: boolean;
3
- disabled: boolean;
4
10
  private now;
5
11
  private index;
6
12
  private internalCycles;
@@ -9,7 +15,7 @@ export declare class Burst {
9
15
  private readonly count;
10
16
  private readonly cycles;
11
17
  private readonly probability;
12
- constructor(opts: any);
18
+ constructor(options: BurstOptions);
13
19
  getGeneratorOptions(timePassed: number, lifetime: number): {
14
20
  index: number;
15
21
  total: number;
@@ -19,3 +25,4 @@ export declare class Burst {
19
25
  reset(): void;
20
26
  clone(): Burst;
21
27
  }
28
+ export {};
@@ -17,5 +17,6 @@ export declare class Link<T> {
17
17
  removeNode(node: LinkNode<T>): void;
18
18
  forEach(func: (content: T, index: number) => void, thisObj?: any): void;
19
19
  forEachReverse(func: (content: T, index: number) => void, thisObj?: any): void;
20
+ getNodeByIndex(index: number): LinkNode<T> | null;
20
21
  }
21
22
  export {};
@@ -1,7 +1,7 @@
1
1
  import type * as spec from '@galacean/effects-specification';
2
2
  import type { Engine } from '../../engine';
3
3
  import type { Renderer } from '../../render';
4
- import { AbstractPlugin } from '../index';
4
+ import { AbstractPlugin } from '../plugin';
5
5
  import type { PrecompileOptions } from '../../plugin-system';
6
6
  export declare class ParticleLoader extends AbstractPlugin {
7
7
  engine: Engine;
@@ -140,11 +140,6 @@ export declare class ParticleMesh implements ParticleMeshData {
140
140
  readonly anchor: Vector2;
141
141
  constructor(engine: Engine, props: ParticleMeshProps);
142
142
  getPointColor(index: number): number[];
143
- /**
144
- * 待废弃
145
- * @deprecated - 使用 `particle-system.getPointPosition` 替代
146
- */
147
- getPointPosition(index: number): Vector3;
148
143
  clearPoints(): void;
149
144
  resetGeometryData(geometry: Geometry): void;
150
145
  minusTime(time: number): void;
@@ -112,7 +112,7 @@ type ParticleInteraction = {
112
112
  multiple?: boolean;
113
113
  radius: number;
114
114
  };
115
- interface ParticleSystemOptions extends spec.ParticleOptions {
115
+ export interface ParticleSystemOptions extends spec.ParticleOptions {
116
116
  meshSlots?: number[];
117
117
  }
118
118
  export interface ParticleSystemProps extends Omit<spec.ParticleContent, 'options' | 'renderer' | 'trails'> {
@@ -182,9 +182,15 @@ export declare class ParticleSystem extends Component {
182
182
  raycast(options: ParticleSystemRayCastOptions): Vector3[] | undefined;
183
183
  clearPointTrail(pointIndex: number): void;
184
184
  updatePointTrail(pointIndex: number, emitterLifetime: number, point: Point, startTime: number): void;
185
+ /**
186
+ * 通过索引获取指定index粒子当前时刻的位置
187
+ * @params index - 粒子索引
188
+ */
189
+ getPointPositionByIndex(index: number): Vector3 | null;
190
+ /**
191
+ * 通过粒子参数获取当前时刻粒子的位置
192
+ */
185
193
  getPointPosition(point: Point): Vector3;
186
- onEnd(particle: ParticleSystem): void;
187
- onIterate(particle: ParticleSystem): void;
188
194
  initPoint(data: Record<string, any>): Point;
189
195
  addBurst(burst: Burst, offsets: vec3[]): number;
190
196
  removeBurst(index: number): void;
@@ -6,6 +6,7 @@ import { ParticleSystem } from './particle-system';
6
6
  * @internal
7
7
  */
8
8
  export declare class ParticleBehaviourPlayable extends Playable {
9
+ lastTime: number;
9
10
  particleSystem: ParticleSystem;
10
11
  start(context: FrameContext): void;
11
12
  processFrame(context: FrameContext): void;
@@ -1,6 +1,6 @@
1
1
  import type { SharedShaderWithSource } from './shader';
2
2
  export declare const EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
3
3
  export declare const COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
4
- export declare const COPY_VERTEX_SHADER = "\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
5
- export declare const COPY_FRAGMENT_SHADER = "precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n";
4
+ export declare const COPY_VERTEX_SHADER = "\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
5
+ export declare const COPY_FRAGMENT_SHADER = "precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";
6
6
  export declare function createCopyShader(level: number, writeDepth?: boolean): SharedShaderWithSource;
@@ -16,7 +16,7 @@ export interface GeometryMeshProps extends MeshOptionsBase {
16
16
  }
17
17
  export interface MeshDestroyOptions {
18
18
  geometries?: DestroyOptions;
19
- material?: MaterialDestroyOptions | DestroyOptions.keep;
19
+ material?: MaterialDestroyOptions | DestroyOptions;
20
20
  }
21
21
  /**
22
22
  * Mesh 抽象类
@@ -1,6 +1,4 @@
1
1
  export { default as blend } from './blend.glsl';
2
- export { default as compatibleFrag } from './compatible.frag.glsl';
3
- export { default as compatibleVert } from './compatible.vert.glsl';
4
2
  export { default as itemFrameFrag } from './item-frame.frag.glsl';
5
3
  export { default as integrate } from './integrate.glsl';
6
4
  export { default as itemVert } from './item.vert.glsl';
@@ -17,3 +15,4 @@ export { default as gaussianDownHFrag } from './post-processing/gaussian-down-h.
17
15
  export { default as gaussianDownVFrag } from './post-processing/gaussian-down-v.frag.glsl';
18
16
  export { default as gaussianUpFrag } from './post-processing/gaussian-up.frag.glsl';
19
17
  export { default as thresholdFrag } from './post-processing/threshold.frag.glsl';
18
+ export * from './shader-factory';
@@ -0,0 +1,35 @@
1
+ import type { ShaderMacros } from '../render';
2
+ import { ShaderType } from '../material';
3
+ export interface ShaderCodeOptions {
4
+ level: number;
5
+ shaderType: ShaderType;
6
+ shader: string;
7
+ macros?: ShaderMacros;
8
+ removeVersion?: boolean;
9
+ }
10
+ export declare class ShaderFactory {
11
+ static registerInclude(includeName: string, includeSource: string): void;
12
+ static unRegisterInclude(includeName: string): void;
13
+ static unRegisterAllIncludes(): void;
14
+ /**
15
+ * 生成 shader,检测到 WebGL1 上下文会降级
16
+ * @param macros - 宏定义数组
17
+ * @param shader - 原始 shader 文本
18
+ * @param shaderType - shader 类型
19
+ * @return 去除版本号的 shader 文本
20
+ */
21
+ static genFinalShaderCode(options: ShaderCodeOptions): string;
22
+ /**
23
+ * Convert lower GLSL version to GLSL 300 es.
24
+ * @param source - code
25
+ * @param isFragment - Whether it is a fragment shader.
26
+ * */
27
+ private static convertTo300;
28
+ private static parseIncludes;
29
+ private static genMacroString;
30
+ private static genShaderVersion;
31
+ private static isVersion300;
32
+ private static removeWebGLVersion;
33
+ private static has300Output;
34
+ private static replaceMRTShader;
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-core",
3
- "version": "2.0.0-alpha.32",
3
+ "version": "2.0.0-alpha.34",
4
4
  "description": "Galacean Effects runtime core for the web",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",