@galacean/effects-core 2.0.0-alpha.16 → 2.0.0-alpha.18

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.
@@ -1,17 +1,17 @@
1
1
  import * as spec from '@galacean/effects-specification';
2
- import type { ShaderMarcos } from '../render';
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 marcos - 宏定义数组
9
+ * @param macros - 宏定义数组
10
10
  * @param shader - 原始 shader 文本
11
11
  * @param shaderType - shader 类型
12
12
  * @return 去除版本号的 shader 文本
13
13
  */
14
- export declare function createShaderWithMarcos(marcos: ShaderMarcos, shader: string, shaderType: ShaderType, level: number): string;
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;
@@ -1,5 +1,4 @@
1
1
  import type { Euler, Vector3 } from '@galacean/effects-math/es/core/index';
2
- import type * as spec from '@galacean/effects-specification';
3
2
  import type { ValueGetter } from '../../math';
4
3
  import { TrackAsset } from '../timeline/track';
5
4
  import type { TimelineAsset } from './timeline-asset';
@@ -24,7 +23,5 @@ export type ItemLinearVelOverLifetime = {
24
23
  * @internal
25
24
  */
26
25
  export declare class ObjectBindingTrack extends TrackAsset {
27
- data: spec.EffectsObjectData;
28
26
  create(timelineAsset: TimelineAsset): void;
29
- fromData(data: spec.EffectsObjectData): void;
30
27
  }
@@ -25,5 +25,4 @@ export * from './timeline/tracks/sprite-color-track';
25
25
  export * from './timeline/tracks/sub-composition-track';
26
26
  export * from './timeline/playables/sub-composition-playable-asset';
27
27
  export * from './cal/timeline-asset';
28
- export * from './text/text-item';
29
- export * from './text/text-loader';
28
+ export * from './text';
@@ -24,5 +24,5 @@ export declare class InteractComponent extends RendererComponent {
24
24
  beginDragTarget(options: spec.DragInteractOption, eventSystem: EventSystem): void;
25
25
  getHitTestParams: (force?: boolean) => HitTestTriangleParams | void;
26
26
  getBoundingBox(): BoundingBoxTriangle | void;
27
- fromData(data: any): void;
27
+ fromData(data: spec.InteractContent): void;
28
28
  }
@@ -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, env: string | undefined, gpuCapability: GPUCapability): {
154
+ export declare function getParticleMeshShader(item: spec.ParticleItem, gpuCapability: GPUCapability, env?: string): {
155
155
  shader: SharedShaderWithSource;
156
156
  vertex: number;
157
157
  fragment: number;
@@ -192,6 +192,6 @@ export declare class ParticleSystem extends Component {
192
192
  resumeParticleEmission(): void;
193
193
  getBoundingBox(): void | BoundingBoxSphere;
194
194
  getHitTestParams: (force?: boolean) => void | HitTestCustomParams;
195
- fromData(data: any): void;
195
+ fromData(data: unknown): void;
196
196
  }
197
197
  export {};
@@ -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, env: string | undefined, gpuCapability: GPUCapability): ShaderWithSource;
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;
@@ -0,0 +1,4 @@
1
+ export * from './text-item';
2
+ export * from './text-layout';
3
+ export * from './text-style';
4
+ export * from './text-loader';
@@ -2,6 +2,20 @@ import { ItemEndBehavior } from '@galacean/effects-specification';
2
2
  import type { Engine } from '../../engine';
3
3
  import type { PlayableGraph } from '../cal/playable-graph';
4
4
  import { Playable, PlayableAsset, PlayableOutput } from '../cal/playable-graph';
5
+ /**
6
+ * @since 2.0.0
7
+ * @internal
8
+ */
9
+ export declare class TimelineClip {
10
+ id: string;
11
+ name: string;
12
+ start: number;
13
+ duration: number;
14
+ asset: PlayableAsset;
15
+ endBehaviour: ItemEndBehavior;
16
+ constructor();
17
+ toLocalTime(time: number): number;
18
+ }
5
19
  /**
6
20
  * @since 2.0.0
7
21
  * @internal
@@ -38,20 +52,6 @@ export declare enum TrackType {
38
52
  MasterTrack = 0,
39
53
  ObjectTrack = 1
40
54
  }
41
- /**
42
- * @since 2.0.0
43
- * @internal
44
- */
45
- export declare class TimelineClip {
46
- id: string;
47
- name: string;
48
- start: number;
49
- duration: number;
50
- asset: PlayableAsset;
51
- endBehaviour: ItemEndBehavior;
52
- constructor();
53
- toLocalTime(time: number): number;
54
- }
55
55
  export declare class RuntimeClip {
56
56
  clip: TimelineClip;
57
57
  playable: Playable;
@@ -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 ShaderMarcos = [key: string, value: string | number | boolean][];
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
- marcos?: ShaderMarcos;
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
- marcos?: ShaderMarcos;
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?: ShaderMarcos): ShaderVariant;
97
+ createShader(shaderSource: ShaderWithSource, macros?: ShaderMacros): ShaderVariant;
98
98
  /**
99
99
  * @param cacheId
100
100
  */
@@ -1,14 +1,15 @@
1
+ import type * as spec from '@galacean/effects-specification';
1
2
  import { EffectsObject } from './effects-object';
2
3
  export declare class SerializationHelper {
3
4
  static collectSerializableObject(effectsObject: EffectsObject, res: Record<string, EffectsObject>): void;
4
5
  static serializeEffectObject(effectsObject: EffectsObject): Record<string, any>;
5
6
  static serializeTaggedProperties(effectsObject: EffectsObject, serializedData?: Record<string, any>): Record<string, any>;
6
- static deserializeTaggedProperties(serializedData: Record<string, any>, effectsObject: EffectsObject): void;
7
- static deserializeTaggedPropertiesAsync(serializedData: Record<string, any>, effectsObject: EffectsObject): Promise<void>;
8
- static checkTypedArray(obj: any): boolean;
9
- static checkDataPath(value: any): boolean;
7
+ static deserializeTaggedProperties(serializedData: spec.EffectsObjectData, effectsObject: EffectsObject): void;
8
+ static deserializeTaggedPropertiesAsync(serializedData: spec.EffectsObjectData, effectsObject: EffectsObject): Promise<void>;
9
+ static checkTypedArray(obj: unknown): boolean;
10
+ static checkDataPath(value: unknown): value is spec.DataPath;
10
11
  static checkGLTFNode(value: any): boolean;
11
- static checkImageSource(value: any): boolean;
12
+ static checkImageSource(value: HTMLCanvasElement): boolean;
12
13
  private static deserializeProperty;
13
14
  private static deserializePropertyAsync;
14
15
  private static serializeObjectProperty;
@@ -18,4 +18,4 @@ export type ShapeGenerator = Shape & {
18
18
  alignSpeedDirection?: boolean;
19
19
  upDirection?: Vector3;
20
20
  };
21
- export declare function createShape(shapeOptions: spec.ParticleShape): Shape;
21
+ export declare function createShape(shapeOptions?: spec.ParticleShape): Shape;
@@ -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(texOpts: TextureJSONOptions, bins: ArrayBuffer[], files: spec.BinaryFile[] | undefined, engine: Engine): Promise<Texture2DSourceOptions | TextureCubeSourceOptions>;
5
+ export declare function deserializeMipmapTexture(textureOptions: TextureJSONOptions, bins: ArrayBuffer[], engine: Engine, files?: spec.BinaryFile[]): Promise<Texture2DSourceOptions | TextureCubeSourceOptions>;
6
6
  export {};
@@ -22,7 +22,7 @@ export declare class Transform implements Disposable {
22
22
  static getRotation(quat: Quaternion, out: Euler): Euler;
23
23
  engine: Engine;
24
24
  name: string;
25
- taggedProperties: Record<string, any>;
25
+ taggedProperties: spec.TransformData;
26
26
  /**
27
27
  * 自身位移
28
28
  */
@@ -223,8 +223,8 @@ export declare class Transform implements Disposable {
223
223
  * 获取 Transform 是否生效
224
224
  */
225
225
  getValid(): boolean;
226
- toData(): Record<string, any>;
227
- fromData(data: any): void;
226
+ toData(): spec.TransformData;
227
+ fromData(data: spec.TransformData): void;
228
228
  dispose(): void;
229
229
  private updateTRSCache;
230
230
  private dispatchValueChange;
@@ -35,17 +35,17 @@ export declare function noop(): void;
35
35
  *
36
36
  * @static
37
37
  * @function isString
38
- * @param {object} obj - 要判断的对象
39
- * @return {boolean}
38
+ * @param obj - 要判断的对象
39
+ * @return
40
40
  */
41
- export declare function isString(obj: any): obj is string;
41
+ export declare function isString(obj: unknown): obj is string;
42
42
  /**
43
43
  * 判断对象是否是`Array`类型
44
44
  *
45
45
  * @static
46
46
  * @function isArray
47
- * @param {object} obj - 要判断的对象
48
- * @return {boolean}
47
+ * @param obj - 要判断的对象
48
+ * @return
49
49
  */
50
50
  export declare const isArray: (arg: any) => arg is any[];
51
51
  /**
@@ -53,22 +53,27 @@ export declare const isArray: (arg: any) => arg is any[];
53
53
  *
54
54
  * @static
55
55
  * @function isFunction
56
- * @param {object} obj - 要判断的对象
57
- * @return {boolean}
56
+ * @param obj - 要判断的对象
57
+ * @return
58
58
  */
59
- export declare function isFunction(obj: any): boolean;
59
+ export declare function isFunction(obj: unknown): boolean;
60
60
  /**
61
61
  * 判断对象是否是`Object`类型
62
62
  *
63
63
  * @static
64
64
  * @function isObject
65
- * @param {object} obj - 要判断的对象
66
- * @return {boolean}
65
+ * @param obj - 要判断的对象
66
+ * @return
67
67
  */
68
- export declare function isObject(obj: any): boolean;
68
+ export declare function isObject(obj: unknown): obj is Record<string | symbol, unknown>;
69
69
  export declare function isCanvas(canvas: HTMLCanvasElement): boolean;
70
- export declare function deepClone(obj: any): any;
71
- export declare function random(min: number, max: number): number;
70
+ /**
71
+ * 生成一个位于 min max 之间的随机数
72
+ * @param min
73
+ * @param max
74
+ * @returns
75
+ */
76
+ export declare function randomInRange(min: number, max: number): number;
72
77
  export declare function throwDestroyedError(): void;
73
78
  export declare function generateGUID(): string;
74
79
  export declare function base64ToFile(base64: string, filename?: string, contentType?: string): File;
@@ -1,8 +1,7 @@
1
1
  import { Vector3 } from '@galacean/effects-math/es/core/vector3';
2
2
  import * as spec from '@galacean/effects-specification';
3
3
  import type { VFXItemData } from './asset-loader';
4
- import type { Component } from './components';
5
- import { RendererComponent, ItemBehaviour } from './components';
4
+ import type { Component, RendererComponent, ItemBehaviour } from './components';
6
5
  import type { Composition } from './composition';
7
6
  import { EffectsObject } from './effects-object';
8
7
  import type { Engine } from './engine';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-core",
3
- "version": "2.0.0-alpha.16",
3
+ "version": "2.0.0-alpha.18",
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.0.0-alpha.17",
45
+ "@galacean/effects-specification": "2.0.0-alpha.19",
46
46
  "@galacean/effects-math": "1.1.0",
47
47
  "uuid": "9.0.1"
48
48
  },