@galacean/effects-specification 2.1.0-beta.0 → 2.1.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.
Files changed (96) hide show
  1. package/es/animation-clip-data.d.ts +1 -1
  2. package/es/assets.d.ts +95 -0
  3. package/es/assets.js +18 -0
  4. package/es/binary.d.ts +2 -1
  5. package/es/buitin-object-guid.d.ts +1 -0
  6. package/es/buitin-object-guid.js +1 -0
  7. package/es/components/component-data.d.ts +7 -0
  8. package/es/components/component-data.js +1 -0
  9. package/es/components/index.d.ts +2 -0
  10. package/es/components/index.js +2 -0
  11. package/es/components/post-process-volume-data.d.ts +38 -0
  12. package/es/components/post-process-volume-data.js +1 -0
  13. package/es/composition.d.ts +0 -4
  14. package/es/curve-data/color-curve-data.d.ts +7 -0
  15. package/es/curve-data/color-curve-data.js +1 -0
  16. package/es/curve-data/index.d.ts +2 -0
  17. package/es/curve-data/index.js +2 -0
  18. package/es/curve-data/vector4-curve-data.d.ts +7 -0
  19. package/es/curve-data/vector4-curve-data.js +1 -0
  20. package/es/data-type.d.ts +47 -0
  21. package/es/data-type.js +50 -0
  22. package/es/effects-object-data.d.ts +6 -0
  23. package/es/effects-object-data.js +1 -0
  24. package/es/effects-package-data.d.ts +9 -0
  25. package/es/effects-package-data.js +1 -0
  26. package/es/{components.d.ts → geometry-data.d.ts} +1 -95
  27. package/es/{components.js → geometry-data.js} +0 -39
  28. package/es/index.d.ts +15 -2
  29. package/es/index.js +15 -2
  30. package/es/item/audio-item.d.ts +46 -0
  31. package/es/item/audio-item.js +1 -0
  32. package/es/item/base-item.d.ts +3 -10
  33. package/es/item/effect-item.d.ts +6 -0
  34. package/es/item/interact-item.d.ts +1 -5
  35. package/es/item/model/light.d.ts +6 -1
  36. package/es/item/model/render.d.ts +5 -1
  37. package/es/item/model/render.js +4 -0
  38. package/es/item/model/skybox.d.ts +4 -11
  39. package/es/item/model/tree.d.ts +12 -12
  40. package/es/item/particle-item.d.ts +3 -68
  41. package/es/item/particle-shape.d.ts +12 -12
  42. package/es/item/rich-text-item.d.ts +35 -0
  43. package/es/item/rich-text-item.js +1 -0
  44. package/es/item/spine-item.d.ts +7 -2
  45. package/es/item/sprite-item.d.ts +1 -43
  46. package/es/item/text-item.d.ts +35 -64
  47. package/es/item/video-item.d.ts +82 -0
  48. package/es/item/video-item.js +1 -0
  49. package/es/item.d.ts +4 -1
  50. package/es/material-data.d.ts +21 -0
  51. package/es/material-data.js +1 -0
  52. package/es/math/color-data.d.ts +6 -0
  53. package/es/math/color-data.js +1 -0
  54. package/es/math/index.d.ts +2 -0
  55. package/es/math/index.js +2 -0
  56. package/es/math/vector-data.d.ts +15 -0
  57. package/es/math/vector-data.js +1 -0
  58. package/es/number-expression.d.ts +18 -1
  59. package/es/number-expression.js +8 -0
  60. package/es/render-settings.d.ts +4 -0
  61. package/es/render-settings.js +1 -0
  62. package/es/scene.d.ts +28 -7
  63. package/es/shader-data.d.ts +6 -0
  64. package/es/shader-data.js +1 -0
  65. package/es/shape/custom-shape-data.d.ts +73 -0
  66. package/es/shape/custom-shape-data.js +1 -0
  67. package/es/shape/ellipse-data.d.ts +33 -0
  68. package/es/shape/ellipse-data.js +1 -0
  69. package/es/shape/index.d.ts +9 -0
  70. package/es/shape/index.js +9 -0
  71. package/es/shape/polygon-data.d.ts +33 -0
  72. package/es/shape/polygon-data.js +1 -0
  73. package/es/shape/rectangle-data.d.ts +33 -0
  74. package/es/shape/rectangle-data.js +1 -0
  75. package/es/shape/shape-component-data.d.ts +11 -0
  76. package/es/shape/shape-component-data.js +1 -0
  77. package/es/shape/shape-fill-param.d.ts +10 -0
  78. package/es/shape/shape-fill-param.js +1 -0
  79. package/es/shape/shape-primitive-type.d.ts +25 -0
  80. package/es/shape/shape-primitive-type.js +26 -0
  81. package/es/shape/shape-stroke-param.d.ts +26 -0
  82. package/es/shape/shape-stroke-param.js +8 -0
  83. package/es/shape/star-data.d.ts +41 -0
  84. package/es/shape/star-data.js +1 -0
  85. package/es/texture.d.ts +48 -0
  86. package/es/texture.js +1 -0
  87. package/es/timeline/playables/sprite-color-playable-asset-data.d.ts +2 -1
  88. package/es/timeline/playables/transform-playable-asset-data.d.ts +2 -1
  89. package/es/timeline/timeline-asset-data.d.ts +3 -1
  90. package/es/timeline/track/track-asset-data.d.ts +2 -1
  91. package/es/type.d.ts +25 -16
  92. package/es/type.js +33 -13
  93. package/es/vfx-item-data.d.ts +2 -1
  94. package/package.json +4 -5
  95. package/es/image.d.ts +0 -123
  96. package/es/image.js +0 -9
@@ -0,0 +1,41 @@
1
+ import type { TransformData } from '../item/base-item';
2
+ import type { ShapeComponentData } from './shape-component-data';
3
+ import type { ShapeFillParam } from './shape-fill-param';
4
+ import type { ShapeStrokeParam } from './shape-stroke-param';
5
+ /**
6
+ * 星形参数
7
+ */
8
+ export interface StarData extends ShapeComponentData {
9
+ /**
10
+ * 顶点数 - 内外顶点同数
11
+ */
12
+ pointCount: number;
13
+ /**
14
+ * 内径
15
+ */
16
+ innerRadius: number;
17
+ /**
18
+ * 外径
19
+ */
20
+ outerRadius: number;
21
+ /**
22
+ * 内径点圆度
23
+ */
24
+ innerRoundness: number;
25
+ /**
26
+ * 外径点圆度
27
+ */
28
+ outerRoundness: number;
29
+ /**
30
+ * 填充属性
31
+ */
32
+ fill?: ShapeFillParam;
33
+ /**
34
+ * 描边属性
35
+ */
36
+ stroke?: ShapeStrokeParam;
37
+ /**
38
+ * 空间变换
39
+ */
40
+ transform?: TransformData;
41
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,48 @@
1
+ import type { BinaryPointer } from './binary';
2
+ import type { DataType } from './data-type';
3
+ export interface TextureFormatOptions {
4
+ format?: GLenum;
5
+ internalFormat?: GLenum;
6
+ type?: GLenum;
7
+ }
8
+ export interface TextureConfigOptionsBase {
9
+ generateMipmap?: boolean;
10
+ id?: string;
11
+ dataType?: DataType.Texture;
12
+ name?: string;
13
+ wrapS?: GLenum;
14
+ wrapT?: GLenum;
15
+ magFilter?: GLenum;
16
+ minFilter?: GLenum;
17
+ anisotropic?: number;
18
+ flipY?: boolean;
19
+ premultiplyAlpha?: boolean;
20
+ keepImageSource?: boolean;
21
+ }
22
+ export type SerializedTextureCubeMipmap = [
23
+ TEXTURE_CUBE_MAP_POSITIVE_X: BinaryPointer,
24
+ TEXTURE_CUBE_MAP_NEGATIVE_X: BinaryPointer,
25
+ TEXTURE_CUBE_MAP_POSITIVE_Y: BinaryPointer,
26
+ TEXTURE_CUBE_MAP_NEGATIVE_Y: BinaryPointer,
27
+ TEXTURE_CUBE_MAP_POSITIVE_Z: BinaryPointer,
28
+ TEXTURE_CUBE_MAP_NEGATIVE_Z: BinaryPointer
29
+ ];
30
+ export interface SerializedTexture2DImageSource extends TextureConfigOptionsBase, TextureFormatOptions {
31
+ dataType: DataType.Texture;
32
+ target?: WebGLRenderingContext['TEXTURE_2D'];
33
+ source: number;
34
+ }
35
+ export interface SerializedTexture2DMipmapSource extends TextureConfigOptionsBase, TextureFormatOptions {
36
+ dataType: DataType.Texture;
37
+ target?: WebGLRenderingContext['TEXTURE_2D'];
38
+ mipmaps: BinaryPointer[];
39
+ }
40
+ export interface SerializedTextureCube extends TextureConfigOptionsBase, TextureFormatOptions {
41
+ dataType: DataType.Texture;
42
+ target: WebGLRenderingContext['TEXTURE_CUBE_MAP'];
43
+ mipmaps: SerializedTextureCubeMipmap[];
44
+ }
45
+ export type SerializedTexture2D = SerializedTexture2DImageSource | SerializedTexture2DMipmapSource;
46
+ export type SerializedTextureSource = SerializedTexture2D | SerializedTextureCube;
47
+ export type TextureJSONOptions = SerializedTextureSource;
48
+ export type TextureDefine = TextureJSONOptions;
package/es/texture.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,7 @@
1
- import type { DataType, EffectsObjectData } from '../../components';
2
1
  import type { RGBAColorValue } from '../../number-expression';
3
2
  import type { ColorOverLifetime } from '../../type';
3
+ import type { DataType } from '../../data-type';
4
+ import type { EffectsObjectData } from '../../effects-object-data';
4
5
  export interface SpriteColorPlayableAssetData extends EffectsObjectData {
5
6
  dataType: DataType.SpriteColorPlayableAsset;
6
7
  colorOverLifetime?: ColorOverLifetime;
@@ -1,5 +1,6 @@
1
- import type { DataType, EffectsObjectData } from '../../components';
1
+ import type { EffectsObjectData } from '../../effects-object-data';
2
2
  import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime } from '../../type';
3
+ import type { DataType } from '../../data-type';
3
4
  export interface TransformPlayableAssetData extends EffectsObjectData {
4
5
  dataType: DataType.TransformPlayableAsset;
5
6
  /**
@@ -1,4 +1,6 @@
1
- import type { EffectsObjectData, DataPath, DataType } from '../components';
1
+ import type { DataPath } from '../components';
2
+ import type { DataType } from '../data-type';
3
+ import type { EffectsObjectData } from '../effects-object-data';
2
4
  export interface TimelineAssetData extends EffectsObjectData {
3
5
  dataType: DataType.TimelineAsset;
4
6
  /**
@@ -1,5 +1,6 @@
1
- import type { DataPath, EffectsObjectData } from '../../components';
1
+ import type { DataPath } from '../../components';
2
2
  import type { TimelineClipData } from '../timeline-clip-data';
3
+ import type { EffectsObjectData } from '../../effects-object-data';
3
4
  export interface TrackAssetData extends EffectsObjectData {
4
5
  /**
5
6
  * 子轨道数据(TrackAssetData)
package/es/type.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { DataPath } from './components';
1
2
  import type { FixedVec3Expression, vec2, vec3, GradientColor, ShapePoints, ShapeSplits, FixedNumberExpression } from './number-expression';
2
3
  /**
3
4
  * 播放器版本
@@ -31,19 +32,6 @@ export interface GLTF {
31
32
  */
32
33
  reuse: boolean;
33
34
  }
34
- /**
35
- * 形状属性
36
- */
37
- export interface Shape {
38
- /**
39
- * 形状 ID
40
- */
41
- id: number;
42
- /**
43
- * 形状数据
44
- */
45
- shape: number[];
46
- }
47
35
  /**
48
36
  * 插件参数
49
37
  */
@@ -329,7 +317,7 @@ export declare enum MaskMode {
329
317
  /**
330
318
  * 发射器形状
331
319
  */
332
- export declare enum ShapeType {
320
+ export declare enum ParticleEmitterShapeType {
333
321
  /**
334
322
  * 没有类型
335
323
  */
@@ -457,7 +445,7 @@ export interface RendererOptions {
457
445
  /**
458
446
  * 贴图,索引到 scene 中的 images 数组
459
447
  */
460
- texture?: number;
448
+ texture?: DataPath;
461
449
  /**
462
450
  * 蒙版模式
463
451
  * @default none
@@ -540,10 +528,30 @@ export declare enum ItemType {
540
528
  * 特效元素
541
529
  */
542
530
  effect = "effect",
531
+ /**
532
+ * 形状元素
533
+ */
534
+ shape = "shape",
535
+ /**
536
+ * 后处理元素
537
+ */
538
+ postProcessVolume = "postProcessVolume",
543
539
  /**
544
540
  * 节点元素
545
541
  */
546
- node = "node"
542
+ node = "node",
543
+ /**
544
+ * 视频元素
545
+ */
546
+ video = "video",
547
+ /**
548
+ * 音频元素
549
+ */
550
+ audio = "audio",
551
+ /**
552
+ * 富文本元素
553
+ */
554
+ richtext = "richtext"
547
555
  }
548
556
  /**
549
557
  * 渲染模式
@@ -670,3 +678,4 @@ export declare enum RenderFace {
670
678
  Back = "Back",
671
679
  Front = "Front"
672
680
  }
681
+ export type HTMLImageLike = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
package/es/type.js CHANGED
@@ -93,49 +93,49 @@ export var MaskMode;
93
93
  /**
94
94
  * 发射器形状
95
95
  */
96
- export var ShapeType;
97
- (function (ShapeType) {
96
+ export var ParticleEmitterShapeType;
97
+ (function (ParticleEmitterShapeType) {
98
98
  /**
99
99
  * 没有类型
100
100
  */
101
- ShapeType[ShapeType["NONE"] = 0] = "NONE";
101
+ ParticleEmitterShapeType[ParticleEmitterShapeType["NONE"] = 0] = "NONE";
102
102
  /**
103
103
  * 圆球
104
104
  */
105
- ShapeType[ShapeType["SPHERE"] = 1] = "SPHERE";
105
+ ParticleEmitterShapeType[ParticleEmitterShapeType["SPHERE"] = 1] = "SPHERE";
106
106
  /**
107
107
  * 圆锥
108
108
  */
109
- ShapeType[ShapeType["CONE"] = 2] = "CONE";
109
+ ParticleEmitterShapeType[ParticleEmitterShapeType["CONE"] = 2] = "CONE";
110
110
  /**
111
111
  * 半球
112
112
  */
113
- ShapeType[ShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
113
+ ParticleEmitterShapeType[ParticleEmitterShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
114
114
  /**
115
115
  * 圆
116
116
  */
117
- ShapeType[ShapeType["CIRCLE"] = 4] = "CIRCLE";
117
+ ParticleEmitterShapeType[ParticleEmitterShapeType["CIRCLE"] = 4] = "CIRCLE";
118
118
  /**
119
119
  * 圆环
120
120
  */
121
- ShapeType[ShapeType["DONUT"] = 5] = "DONUT";
121
+ ParticleEmitterShapeType[ParticleEmitterShapeType["DONUT"] = 5] = "DONUT";
122
122
  /**
123
123
  * 矩形
124
124
  */
125
- ShapeType[ShapeType["RECTANGLE"] = 6] = "RECTANGLE";
125
+ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE"] = 6] = "RECTANGLE";
126
126
  /**
127
127
  * 矩形框
128
128
  */
129
- ShapeType[ShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
129
+ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
130
130
  /**
131
131
  * 直线
132
132
  */
133
- ShapeType[ShapeType["EDGE"] = 8] = "EDGE";
133
+ ParticleEmitterShapeType[ParticleEmitterShapeType["EDGE"] = 8] = "EDGE";
134
134
  /**
135
135
  * 贴图
136
136
  */
137
- ShapeType[ShapeType["TEXTURE"] = 9] = "TEXTURE";
138
- })(ShapeType || (ShapeType = {}));
137
+ ParticleEmitterShapeType[ParticleEmitterShapeType["TEXTURE"] = 9] = "TEXTURE";
138
+ })(ParticleEmitterShapeType || (ParticleEmitterShapeType = {}));
139
139
  /**
140
140
  * 插件类型
141
141
  */
@@ -260,10 +260,30 @@ export var ItemType;
260
260
  * 特效元素
261
261
  */
262
262
  ItemType["effect"] = "effect";
263
+ /**
264
+ * 形状元素
265
+ */
266
+ ItemType["shape"] = "shape";
267
+ /**
268
+ * 后处理元素
269
+ */
270
+ ItemType["postProcessVolume"] = "postProcessVolume";
263
271
  /**
264
272
  * 节点元素
265
273
  */
266
274
  ItemType["node"] = "node";
275
+ /**
276
+ * 视频元素
277
+ */
278
+ ItemType["video"] = "video";
279
+ /**
280
+ * 音频元素
281
+ */
282
+ ItemType["audio"] = "audio";
283
+ /**
284
+ * 富文本元素
285
+ */
286
+ ItemType["richtext"] = "richtext";
267
287
  })(ItemType || (ItemType = {}));
268
288
  /**
269
289
  * 渲染模式
@@ -1,4 +1,5 @@
1
- import type { DataPath, EffectsObjectData } from './components';
1
+ import type { DataPath } from './components';
2
+ import type { EffectsObjectData } from './effects-object-data';
2
3
  import type { EndBehavior, BaseContent, TransformData } from './item/base-item';
3
4
  import type { ItemType, RenderLevel } from './type';
4
5
  export interface VFXItemData extends EffectsObjectData {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-specification",
3
- "version": "2.1.0-beta.0",
3
+ "version": "2.1.0",
4
4
  "description": "Galacean Effects JSON Specification",
5
5
  "module": "./es/index.js",
6
6
  "main": "./es/index.js",
@@ -39,13 +39,12 @@
39
39
  "registry": "https://registry.npmjs.org"
40
40
  },
41
41
  "scripts": {
42
- "prebuild": "npm run clean:all",
43
- "build": "npm run build:lib",
42
+ "prebuild": "pnpm clean",
43
+ "build": "pnpm build:lib",
44
44
  "build:lib": "tsc -b tsconfig.build.json",
45
45
  "lint": "eslint src --ext .ts,.mjs",
46
46
  "lint:fix": "eslint src --fix --quiet --ext .ts,.mjs",
47
47
  "check:ts": "tsc -b tsconfig.check.json",
48
- "clean:all": "npm run clean:lib",
49
- "clean:lib": "rimraf es/**"
48
+ "clean": "rimraf es/**"
50
49
  }
51
50
  }
package/es/image.d.ts DELETED
@@ -1,123 +0,0 @@
1
- import type { RenderLevel } from './type';
2
- import type { BinaryPointer } from './binary';
3
- import type { DataType } from './components';
4
- export interface TextureFormatOptions {
5
- format?: GLenum;
6
- internalFormat?: GLenum;
7
- type?: GLenum;
8
- }
9
- export interface TextureConfigOptionsBase {
10
- generateMipmap?: boolean;
11
- id?: string;
12
- dataType?: DataType.Texture;
13
- name?: string;
14
- wrapS?: GLenum;
15
- wrapT?: GLenum;
16
- magFilter?: GLenum;
17
- minFilter?: GLenum;
18
- anisotropic?: number;
19
- flipY?: boolean;
20
- premultiplyAlpha?: boolean;
21
- keepImageSource?: boolean;
22
- }
23
- export type SerializedTextureCubeMipmap = [
24
- TEXTURE_CUBE_MAP_POSITIVE_X: BinaryPointer,
25
- TEXTURE_CUBE_MAP_NEGATIVE_X: BinaryPointer,
26
- TEXTURE_CUBE_MAP_POSITIVE_Y: BinaryPointer,
27
- TEXTURE_CUBE_MAP_NEGATIVE_Y: BinaryPointer,
28
- TEXTURE_CUBE_MAP_POSITIVE_Z: BinaryPointer,
29
- TEXTURE_CUBE_MAP_NEGATIVE_Z: BinaryPointer
30
- ];
31
- export interface SerializedTexture2DImageSource extends TextureConfigOptionsBase, TextureFormatOptions {
32
- target?: WebGLRenderingContext['TEXTURE_2D'];
33
- source: number;
34
- }
35
- export interface SerializedTexture2DMipmapSource extends TextureConfigOptionsBase, TextureFormatOptions {
36
- target?: WebGLRenderingContext['TEXTURE_2D'];
37
- mipmaps: BinaryPointer[];
38
- }
39
- export interface SerializedTextureCube extends TextureConfigOptionsBase, TextureFormatOptions {
40
- target: WebGLRenderingContext['TEXTURE_CUBE_MAP'];
41
- mipmaps: SerializedTextureCubeMipmap[];
42
- }
43
- export type SerializedTexture2D = SerializedTexture2DImageSource | SerializedTexture2DMipmapSource;
44
- export type SerializedTextureSource = SerializedTexture2D | SerializedTextureCube;
45
- export type TextureJSONOptions = SerializedTextureSource;
46
- export type TextureDefine = TextureJSONOptions;
47
- /**
48
- * 动态换图类型
49
- * @since 1.1.0
50
- */
51
- export declare enum BackgroundType {
52
- video = "video",
53
- image = "image"
54
- }
55
- export interface TemplateContent {
56
- /**
57
- * 当 template 宽高和 image 不相同时,会对 template 进行缩放,使其和 image 相同。
58
- */
59
- width: number;
60
- height: number;
61
- background?: {
62
- type: BackgroundType;
63
- name: string;
64
- url: string | HTMLImageElement;
65
- };
66
- }
67
- export type TemplateVariables = Record<string, string | string[] | HTMLImageElement | HTMLImageElement[]>;
68
- /**
69
- * 纹理贴图属性
70
- */
71
- export interface Image {
72
- id: string;
73
- /**
74
- * 纹理贴图地址
75
- */
76
- url: string;
77
- /**
78
- * WebP 地址
79
- * 如果运行时支持 WebP,则优先使用 WebP
80
- */
81
- webp?: string;
82
- /**
83
- * AVIF 地址
84
- * 如果运行时支持 AVIF,则优先使用 AVIF
85
- * @since 2.0.0
86
- */
87
- avif?: string;
88
- /**
89
- * 纹理贴图渲染等级
90
- * 如果没有设置,按照 B+ 处理
91
- */
92
- renderLevel?: RenderLevel;
93
- /**
94
- * 是否使用 mipmap
95
- * loader 发布压缩纹理的时候会根据此参数决定是否生成压缩纹理
96
- * @default false
97
- */
98
- mipmap?: boolean;
99
- /**
100
- * 图片 Y 轴的方向,如果 Y 轴向上(与 OpenGL 相同)则为 1
101
- * 如果 Y 轴向下(与 OpenGL 相反)则为 -1,图片再绘制数据模板的时候需要翻转绘制
102
- * @default 1
103
- */
104
- oriY?: 1 | -1;
105
- }
106
- /**
107
- * 模板贴图属性
108
- */
109
- export interface TemplateImage extends Image {
110
- template: TemplateContent;
111
- }
112
- /**
113
- * 压缩贴图属性
114
- */
115
- export interface CompressedImage extends Image {
116
- /**
117
- * 压缩贴图地址
118
- */
119
- compressed: {
120
- astc?: string;
121
- pvrtc?: string;
122
- };
123
- }
package/es/image.js DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * 动态换图类型
3
- * @since 1.1.0
4
- */
5
- export var BackgroundType;
6
- (function (BackgroundType) {
7
- BackgroundType["video"] = "video";
8
- BackgroundType["image"] = "image";
9
- })(BackgroundType || (BackgroundType = {}));