@galacean/effects-specification 0.0.1

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 (49) hide show
  1. package/README.md +28 -0
  2. package/dist/fallback/camera.d.ts +2 -0
  3. package/dist/fallback/filter.d.ts +2 -0
  4. package/dist/fallback/index.d.ts +12 -0
  5. package/dist/fallback/interact.d.ts +2 -0
  6. package/dist/fallback/migration.d.ts +5 -0
  7. package/dist/fallback/particle.d.ts +2 -0
  8. package/dist/fallback/sprite.d.ts +3 -0
  9. package/dist/fallback/utils.d.ts +29 -0
  10. package/dist/fallback.js +1664 -0
  11. package/dist/fallback.js.map +1 -0
  12. package/dist/fallback.mjs +1639 -0
  13. package/dist/fallback.mjs.map +1 -0
  14. package/dist/index.js +689 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/index.mjs +674 -0
  17. package/dist/index.mjs.map +1 -0
  18. package/dist/src/binary.d.ts +60 -0
  19. package/dist/src/composition.d.ts +111 -0
  20. package/dist/src/constants.d.ts +11 -0
  21. package/dist/src/image.d.ts +123 -0
  22. package/dist/src/index.d.ts +22 -0
  23. package/dist/src/item/base-item.d.ts +110 -0
  24. package/dist/src/item/camera-item.d.ts +69 -0
  25. package/dist/src/item/composition-item.d.ts +56 -0
  26. package/dist/src/item/filter-item.d.ts +99 -0
  27. package/dist/src/item/interact-item.d.ts +85 -0
  28. package/dist/src/item/model/binary.d.ts +85 -0
  29. package/dist/src/item/model/camera.d.ts +33 -0
  30. package/dist/src/item/model/index.d.ts +35 -0
  31. package/dist/src/item/model/light.d.ts +72 -0
  32. package/dist/src/item/model/material.d.ts +84 -0
  33. package/dist/src/item/model/mesh.d.ts +69 -0
  34. package/dist/src/item/model/render.d.ts +41 -0
  35. package/dist/src/item/model/skybox.d.ts +50 -0
  36. package/dist/src/item/model/tree.d.ts +65 -0
  37. package/dist/src/item/null-item.d.ts +46 -0
  38. package/dist/src/item/particle-item.d.ts +412 -0
  39. package/dist/src/item/particle-shape.d.ts +212 -0
  40. package/dist/src/item/plugin-item.d.ts +46 -0
  41. package/dist/src/item/spine-item.d.ts +93 -0
  42. package/dist/src/item/sprite-item.d.ts +71 -0
  43. package/dist/src/item/text-item.d.ts +172 -0
  44. package/dist/src/item.d.ts +17 -0
  45. package/dist/src/numberExpression.d.ts +279 -0
  46. package/dist/src/scene.d.ts +92 -0
  47. package/dist/src/text.d.ts +183 -0
  48. package/dist/src/type.d.ts +643 -0
  49. package/package.json +67 -0
@@ -0,0 +1,41 @@
1
+ /**
2
+ * 3D渲染模式:将渲染过程中的中间结果输出,主要用于排查渲染效果问题,支持 pbr 和 unlit 材质
3
+ */
4
+ export declare enum RenderMode3D {
5
+ /**
6
+ * 正常渲染
7
+ */
8
+ none = "none",
9
+ /**
10
+ * 纹理坐标
11
+ */
12
+ uv = "uv",
13
+ /**
14
+ * 世界坐标法线
15
+ */
16
+ normal = "normal",
17
+ /**
18
+ * 基础颜色
19
+ */
20
+ basecolor = "basecolor",
21
+ /**
22
+ * 基础颜色 Alpha
23
+ */
24
+ alpha = "alpha",
25
+ /**
26
+ * 金属度
27
+ */
28
+ metallic = "metallic",
29
+ /**
30
+ * 粗超度
31
+ */
32
+ roughness = "roughness",
33
+ /**
34
+ * 环境遮蔽
35
+ */
36
+ ao = "ao",
37
+ /**
38
+ * 自发光
39
+ */
40
+ emissive = "emissive"
41
+ }
@@ -0,0 +1,50 @@
1
+ import type { BaseItem, ItemEndBehavior } from '../base-item';
2
+ import type { BinaryEnv } from '../../binary';
3
+ import type { SkyboxCubeTexturePointer } from './binary';
4
+ import type { ItemType } from 'src/type';
5
+ export interface SkyboxOptions<T extends BinaryEnv> {
6
+ renderable: boolean;
7
+ intensity: number;
8
+ reflectionsIntensity: number;
9
+ irradianceCoeffs?: number[][];
10
+ diffuseImage?: SkyboxCubeTexturePointer<T>;
11
+ specularImage: SkyboxCubeTexturePointer<T>;
12
+ specularImageSize: number;
13
+ specularMipCount: number;
14
+ }
15
+ export interface SkyboxContent<T extends BinaryEnv> {
16
+ options: SkyboxOptions<T>;
17
+ }
18
+ /**
19
+ * 天空盒元素
20
+ */
21
+ export interface ModelSkyboxItem<T extends BinaryEnv> extends BaseItem {
22
+ type: ItemType.skybox;
23
+ pluginName: 'model';
24
+ content: SkyboxContent<T>;
25
+ endBehavior: ItemEndBehavior;
26
+ }
27
+ /**
28
+ * 一个 skybox 打包出来:
29
+ * {
30
+ * type:'skybox',
31
+ * content:{
32
+ * options:{
33
+ * specularImageSize:512,
34
+ * specularImages:[
35
+ * [
36
+ * [20,[0,0,112]],
37
+ * [20,[0,112,234]],
38
+ * [20,[0,234,367]]
39
+ * ...
40
+ * ],//mipmap 0
41
+ * [
42
+ * [20,[0,567,679]],
43
+ * [20,[0,679,890]]
44
+ * ],//mipmap 1
45
+ * ]
46
+ * }
47
+ * }
48
+ * },
49
+ * bins:[{url:'https://big/bin/'}]
50
+ */
@@ -0,0 +1,65 @@
1
+ import type { BinaryEnv } from '../../binary';
2
+ import type { ModelAnimationTrackDataPointer } from './binary';
3
+ import type { BaseItem, BaseItemTransform } from '../base-item';
4
+ import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ItemType } from '../../type';
5
+ export interface TreeNodeOptions {
6
+ name?: string;
7
+ transform?: BaseItemTransform;
8
+ children?: number[];
9
+ id?: string;
10
+ }
11
+ export interface TreeOptions {
12
+ nodes: TreeNodeOptions[];
13
+ children: number[];
14
+ }
15
+ export interface ModelAnimTrackOptions<T extends BinaryEnv> {
16
+ node: number;
17
+ input: ModelAnimationTrackDataPointer<T>;
18
+ output: ModelAnimationTrackDataPointer<T>;
19
+ path: 'translation' | 'rotation' | 'scale' | 'weights';
20
+ interpolation: 'LINEAR' | 'STEP' | 'CUBICSPLINE';
21
+ }
22
+ export interface ModelAnimationOptions<T extends BinaryEnv> {
23
+ name?: string;
24
+ tracks: ModelAnimTrackOptions<T>[];
25
+ }
26
+ /**
27
+ * 3D场景树属性,包含动画数据
28
+ */
29
+ export interface ModelTreeOptions<T extends BinaryEnv> extends TreeOptions {
30
+ /**
31
+ * 默认动画索引,-1表示不播放动画
32
+ */
33
+ animation?: number;
34
+ /**
35
+ * 3D场景树中所有的动画数据
36
+ */
37
+ animations?: ModelAnimationOptions<T>[];
38
+ }
39
+ export interface ModelTreeContent<T extends BinaryEnv> {
40
+ /**
41
+ * 3D场景树元素基础属性
42
+ */
43
+ options: {
44
+ tree: ModelTreeOptions<T>;
45
+ };
46
+ /**
47
+ * 3D场景树元素大小变化属性
48
+ */
49
+ sizeOverLifetime?: SizeOverLifetime;
50
+ /**
51
+ * 3D场景树元素旋转变化属性
52
+ */
53
+ rotationOverLifetime?: RotationOverLifetime;
54
+ /**
55
+ * 3D场景树元素位置变化属性
56
+ */
57
+ positionOverLifetime?: PositionOverLifetime;
58
+ }
59
+ /**
60
+ * 3D场景树元素
61
+ */
62
+ export interface ModelTreeItem<T extends BinaryEnv> extends BaseItem {
63
+ type: ItemType.tree;
64
+ content: ModelTreeContent<T>;
65
+ }
@@ -0,0 +1,46 @@
1
+ import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, ItemType } from '../type';
2
+ import type { RGBAColorValue } from '../numberExpression';
3
+ import type { BaseItem } from './base-item';
4
+ /**
5
+ * 空节点元素
6
+ */
7
+ export interface NullItem extends BaseItem {
8
+ /**
9
+ * 元素类型[指定为null]
10
+ */
11
+ type: ItemType.null;
12
+ /**
13
+ * 空节点元素渲染信息
14
+ */
15
+ content: NullContent;
16
+ }
17
+ /**
18
+ * 空节点元素渲染属性
19
+ */
20
+ export interface NullContent {
21
+ /**
22
+ * 空节点元素基础属性
23
+ */
24
+ options: {
25
+ /**
26
+ * 空节点元素基础颜色
27
+ */
28
+ startColor?: RGBAColorValue;
29
+ };
30
+ /**
31
+ * 空节点元素大小变化属性
32
+ */
33
+ sizeOverLifetime?: SizeOverLifetime;
34
+ /**
35
+ * 空节点元素旋转变化属性
36
+ */
37
+ rotationOverLifetime?: RotationOverLifetime;
38
+ /**
39
+ * 空节点元素位置变化属性
40
+ */
41
+ positionOverLifetime?: PositionOverLifetime;
42
+ /**
43
+ * 空节点元素色彩变化属性
44
+ */
45
+ colorOverLifetime?: ColorOverLifetime;
46
+ }
@@ -0,0 +1,412 @@
1
+ import type { ItemType, RendererOptions, TextureSheetAnimation, BlendingMode, SplitParameter } from '../type';
2
+ import type { FixedNumberExpression, NumberExpression, GradientColor, vec3, FixedVec3Expression, ColorExpression, FunctionExpression } from '../numberExpression';
3
+ import type { BaseItem, ItemEndBehavior } from './base-item';
4
+ import type { ParticleShape } from './particle-shape';
5
+ import type { DistortionFilterParams } from './filter-item';
6
+ /**
7
+ * 粒子交互行为
8
+ */
9
+ export declare enum ParticleInteractionBehavior {
10
+ /**
11
+ * 无
12
+ */
13
+ none = 0,
14
+ /**
15
+ * 移出粒子
16
+ */
17
+ removeParticle = 1
18
+ }
19
+ /**
20
+ * 粒子元素
21
+ */
22
+ export interface ParticleItem extends BaseItem {
23
+ /**
24
+ * 元素类型[指定为particle]
25
+ */
26
+ type: ItemType.particle;
27
+ /**
28
+ * 粒子元素渲染信息
29
+ */
30
+ content: ParticleContent;
31
+ endBehavior: ItemEndBehavior;
32
+ }
33
+ /**
34
+ * 发射器参数
35
+ */
36
+ export interface ParticleEmission {
37
+ /**
38
+ * 每秒发射数
39
+ * @default 0
40
+ */
41
+ rateOverTime: NumberExpression;
42
+ /**
43
+ * 粒子集中发射参数
44
+ */
45
+ bursts?: {
46
+ /**
47
+ * 爆发时间
48
+ */
49
+ time: number;
50
+ /**
51
+ * 爆发粒子数量
52
+ */
53
+ count: number;
54
+ /**
55
+ * 周期
56
+ * @default 0
57
+ */
58
+ cycles?: number;
59
+ /**
60
+ * 爆发时间间隔,单位秒
61
+ * @default 0
62
+ */
63
+ interval?: number;
64
+ }[];
65
+ /**
66
+ * 粒子集中发射偏移参数
67
+ */
68
+ burstOffsets?: {
69
+ /**
70
+ * 爆发的索引
71
+ */
72
+ index: number;
73
+ /**
74
+ * x方向偏移值
75
+ */
76
+ x: number;
77
+ /**
78
+ * y方向偏移值
79
+ */
80
+ y: number;
81
+ /**
82
+ * z方向偏移值
83
+ */
84
+ z: number;
85
+ }[];
86
+ }
87
+ export interface ParticlePositionOverLifetime {
88
+ /**
89
+ * 路程模式
90
+ */
91
+ asMovement?: boolean;
92
+ /**
93
+ * x轴位置变化信息
94
+ */
95
+ linearX?: NumberExpression;
96
+ /**
97
+ * y轴位置变化信息
98
+ */
99
+ linearY?: NumberExpression;
100
+ /**
101
+ * z轴位置变化信息
102
+ */
103
+ linearZ?: NumberExpression;
104
+ /**
105
+ * 环绕模式
106
+ */
107
+ asRotation?: boolean;
108
+ /**
109
+ * x轴环绕角度变化信息
110
+ */
111
+ orbitalX?: NumberExpression;
112
+ /**
113
+ * y轴环绕角度变化信息
114
+ */
115
+ orbitalY?: NumberExpression;
116
+ /**
117
+ * z轴环绕角度变化信息
118
+ */
119
+ orbitalZ?: NumberExpression;
120
+ /**
121
+ * 环绕中心信息
122
+ * @default [0,0,0]
123
+ */
124
+ orbCenter?: vec3;
125
+ /**
126
+ * 终点汇聚(发射器专有参数)
127
+ */
128
+ forceTarget?: boolean;
129
+ /**
130
+ * 终点汇聚位置
131
+ * @default [0,0,0]
132
+ */
133
+ target?: vec3;
134
+ /**
135
+ * 终点汇聚函数
136
+ * @default 0
137
+ */
138
+ forceCurve?: FunctionExpression;
139
+ /**
140
+ * 增加一个初速度,匀速直线运动,direction为运动方向
141
+ * @default 0
142
+ */
143
+ startSpeed?: NumberExpression;
144
+ /**
145
+ * 速度变化信息
146
+ */
147
+ speedOverLifetime?: FixedNumberExpression;
148
+ /**
149
+ * 增加一个重力,gravity为重力方向,gravityModifier为重力大小
150
+ * @default 0
151
+ */
152
+ gravity?: vec3;
153
+ /**
154
+ * 重力变化信息
155
+ */
156
+ gravityOverLifetime?: FixedNumberExpression;
157
+ }
158
+ export interface ParticleRotationOverLifetime {
159
+ /**
160
+ * 分轴变化开关
161
+ */
162
+ separateAxes?: boolean;
163
+ /**
164
+ * 角度模式
165
+ */
166
+ asRotation?: boolean;
167
+ /**
168
+ * x轴旋转函数
169
+ */
170
+ x?: NumberExpression;
171
+ /**
172
+ * y轴旋转函数
173
+ */
174
+ y?: NumberExpression;
175
+ /**
176
+ * z轴旋转函数(不分轴时,变化z)
177
+ */
178
+ z?: NumberExpression;
179
+ }
180
+ export interface ParticleSizeOverLifetime {
181
+ /**
182
+ * 分轴变化开关
183
+ */
184
+ separateAxes?: boolean;
185
+ /**
186
+ * 整体大小变化信息(非分轴模式)
187
+ */
188
+ size?: NumberExpression;
189
+ /**
190
+ * x轴大小变化信息(分轴模式)
191
+ */
192
+ x?: NumberExpression;
193
+ /**
194
+ * y轴大小变化信息(分轴模式)
195
+ */
196
+ y?: NumberExpression;
197
+ }
198
+ /**
199
+ * 粒子颜色变化属性
200
+ */
201
+ export interface ParticleColorOverLifetime {
202
+ /**
203
+ * 颜色属性
204
+ */
205
+ color?: GradientColor;
206
+ /**
207
+ * 透明度属性变化值
208
+ */
209
+ opacity?: NumberExpression;
210
+ }
211
+ /**
212
+ * 粒子元素雪碧图/帧动画属性
213
+ */
214
+ export interface ParticleTextureSheetAnimation extends TextureSheetAnimation {
215
+ /**
216
+ * 帧融合(仅存在于粒子元素中),因为展示效果不好,不再支持
217
+ */
218
+ /**
219
+ * 帧动画循环次数(仅存在于粒子元素中)变化
220
+ */
221
+ cycles: NumberExpression;
222
+ /**
223
+ * 帧动画延时(仅存在于粒子元素中), 遇随机数兼容取最小值
224
+ */
225
+ animationDelay?: NumberExpression;
226
+ /**
227
+ * 帧动画时长(仅存在于粒子元素中), 遇随机数兼容取最小值
228
+ */
229
+ animationDuration: NumberExpression;
230
+ }
231
+ export interface ParticleOptions {
232
+ /**
233
+ * 最大粒子数
234
+ */
235
+ maxCount: number;
236
+ /**
237
+ * 粒子生命周期时长
238
+ */
239
+ startLifetime: NumberExpression;
240
+ /**
241
+ * 渲染延时
242
+ * @default 0
243
+ */
244
+ startDelay?: NumberExpression;
245
+ /**
246
+ * 粒子颜色
247
+ */
248
+ startColor?: ColorExpression;
249
+ /**
250
+ * 粒子元素大小
251
+ * 按照宽高比生成时:`start3DSize` 为 `false`,使用 `startSize`(宽度)和 `sizeAspect`(宽度/高度)
252
+ * 按照具体宽高生成时:使用 `startSizeX`,`startSizeY`
253
+ */
254
+ startSize?: NumberExpression;
255
+ sizeAspect?: NumberExpression;
256
+ start3DSize?: boolean;
257
+ startSizeX?: NumberExpression;
258
+ startSizeY?: NumberExpression;
259
+ /**
260
+ * 粒子旋转角度
261
+ */
262
+ startRotationZ?: NumberExpression;
263
+ startRotationX?: NumberExpression;
264
+ startRotationY?: NumberExpression;
265
+ particleFollowParent?: boolean;
266
+ }
267
+ /**
268
+ * 粒子元素渲染属性
269
+ */
270
+ export interface ParticleContent {
271
+ splits?: SplitParameter[];
272
+ /**
273
+ * 粒子元素基础属性
274
+ */
275
+ options: ParticleOptions;
276
+ /**
277
+ * 粒子元素材质渲染属性
278
+ */
279
+ renderer: RendererOptions;
280
+ /**
281
+ * 粒子元素发射器形状属性
282
+ */
283
+ shape?: ParticleShape;
284
+ /**
285
+ * 粒子元素发射参数属性
286
+ */
287
+ emission: ParticleEmission;
288
+ /**
289
+ * 粒子元素大小变化属性
290
+ */
291
+ sizeOverLifetime?: ParticleSizeOverLifetime;
292
+ /**
293
+ * 发射器 transform 变化
294
+ */
295
+ emitterTransform?: {
296
+ /**
297
+ * 位置变化
298
+ */
299
+ path?: FixedVec3Expression;
300
+ };
301
+ positionOverLifetime?: ParticlePositionOverLifetime;
302
+ /**
303
+ * 粒子元素旋转变化属性
304
+ */
305
+ rotationOverLifetime?: ParticleRotationOverLifetime;
306
+ /**
307
+ * 粒子元素色彩变化属性
308
+ */
309
+ colorOverLifetime?: ParticleColorOverLifetime;
310
+ /**
311
+ * 粒子元素贴图变化属性
312
+ */
313
+ textureSheetAnimation?: ParticleTextureSheetAnimation;
314
+ /**
315
+ * 粒子元素拖尾参数
316
+ */
317
+ trails?: ParticleTrail;
318
+ /**
319
+ * 粒子元素交互参数
320
+ */
321
+ interaction?: {
322
+ /**
323
+ * 交互行为
324
+ */
325
+ behavior?: ParticleInteractionBehavior;
326
+ /**
327
+ * 重叠元素响应开关
328
+ */
329
+ multiple?: boolean;
330
+ /**
331
+ * ray cast 射线拾取时 sphere 的半径
332
+ * @default 0.4
333
+ */
334
+ radius?: number;
335
+ };
336
+ filter?: DistortionFilterParams;
337
+ }
338
+ /**
339
+ * 粒子拖尾参数
340
+ */
341
+ export interface ParticleTrail {
342
+ /**
343
+ * 随粒子消失开关
344
+ */
345
+ dieWithParticles?: boolean;
346
+ /**
347
+ * 拖尾声明周期
348
+ */
349
+ lifetime: NumberExpression;
350
+ /**
351
+ * 最大顶点数z
352
+ */
353
+ maxPointPerTrail: number;
354
+ /**
355
+ * 顶点长度
356
+ */
357
+ minimumVertexDistance: number;
358
+ /**
359
+ * 宽度位置变化
360
+ */
361
+ widthOverTrail: NumberExpression;
362
+ /**
363
+ * 颜色位置变化
364
+ */
365
+ colorOverTrail?: GradientColor;
366
+ /**
367
+ * 混合模式
368
+ */
369
+ blending: BlendingMode;
370
+ /**
371
+ * 颜色周期变化
372
+ */
373
+ colorOverLifetime?: GradientColor;
374
+ /**
375
+ * 继承粒子颜色开关
376
+ */
377
+ inheritParticleColor?: boolean;
378
+ /**
379
+ * 深度遮挡
380
+ */
381
+ occlusion?: boolean;
382
+ /**
383
+ * 透明遮挡
384
+ */
385
+ transparentOcclusion?: boolean;
386
+ /**
387
+ * 透明度周期变化
388
+ */
389
+ opacityOverLifetime?: NumberExpression;
390
+ /**
391
+ * 渲染顺序偏移
392
+ * @default 0
393
+ */
394
+ orderOffset?: number;
395
+ /**
396
+ * 生命周期受粒子影响开关
397
+ */
398
+ sizeAffectsLifetime?: boolean;
399
+ /**
400
+ * 宽度受粒子影响开关
401
+ */
402
+ sizeAffectsWidth?: boolean;
403
+ /**
404
+ * 拖尾贴图
405
+ */
406
+ texture?: number;
407
+ /**
408
+ * 位置受父节点影响
409
+ * 拖尾+图层绑定同一个父节点时使用
410
+ */
411
+ parentAffectsPosition?: boolean;
412
+ }