@galacean/effects-specification 2.0.0-alpha.1 → 2.0.0-alpha.10

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 (88) hide show
  1. package/README.md +2 -10
  2. package/{dist/src → es}/binary.d.ts +1 -1
  3. package/es/binary.js +1 -0
  4. package/es/buitin-object-guid.d.ts +5 -0
  5. package/es/buitin-object-guid.js +5 -0
  6. package/{dist/src → es}/components.d.ts +42 -3
  7. package/es/components.js +52 -0
  8. package/{dist/src → es}/composition.d.ts +8 -8
  9. package/es/composition.js +42 -0
  10. package/es/constants.js +11 -0
  11. package/{dist/src → es}/image.d.ts +17 -23
  12. package/es/image.js +9 -0
  13. package/{dist/src → es}/index.d.ts +3 -2
  14. package/es/index.js +26 -0
  15. package/{dist/src → es}/item/base-item.d.ts +9 -6
  16. package/es/item/base-item.js +11 -0
  17. package/{dist/src → es}/item/camera-item.d.ts +1 -1
  18. package/es/item/camera-item.js +1 -0
  19. package/es/item/composition-item.js +1 -0
  20. package/es/item/effect-item.d.ts +35 -0
  21. package/es/item/effect-item.js +1 -0
  22. package/es/item/interact-item.js +1 -0
  23. package/es/item/model/binary.js +1 -0
  24. package/{dist/src → es}/item/model/camera.d.ts +20 -4
  25. package/es/item/model/camera.js +5 -0
  26. package/es/item/model/index.js +35 -0
  27. package/es/item/model/light.js +19 -0
  28. package/{dist/src → es}/item/model/material.d.ts +3 -3
  29. package/es/item/model/material.js +16 -0
  30. package/{dist/src → es}/item/model/mesh.d.ts +3 -3
  31. package/es/item/model/mesh.js +5 -0
  32. package/es/item/model/render.js +42 -0
  33. package/es/item/model/skybox.js +1 -0
  34. package/es/item/model/tree.js +1 -0
  35. package/es/item/null-item.js +1 -0
  36. package/{dist/src → es}/item/particle-item.d.ts +0 -3
  37. package/es/item/particle-item.js +14 -0
  38. package/es/item/particle-shape.js +19 -0
  39. package/es/item/plugin-item.js +1 -0
  40. package/es/item/spine-item.js +1 -0
  41. package/es/item/sprite-item.js +1 -0
  42. package/es/item/text-item.js +1 -0
  43. package/{dist/src → es}/item.d.ts +1 -2
  44. package/es/item.js +1 -0
  45. package/{dist/src → es}/number-expression.d.ts +6 -6
  46. package/es/number-expression.js +87 -0
  47. package/{dist/src → es}/scene.d.ts +4 -6
  48. package/es/scene.js +1 -0
  49. package/{dist/src → es}/text.d.ts +1 -7
  50. package/es/text.js +84 -0
  51. package/{dist/src → es}/type.d.ts +20 -8
  52. package/es/type.js +327 -0
  53. package/{dist/src → es}/vfx-item-data.d.ts +3 -3
  54. package/es/vfx-item-data.js +1 -0
  55. package/package.json +26 -47
  56. package/dist/fallback/camera.d.ts +0 -2
  57. package/dist/fallback/filter.d.ts +0 -2
  58. package/dist/fallback/index.d.ts +0 -12
  59. package/dist/fallback/interact.d.ts +0 -2
  60. package/dist/fallback/migration.d.ts +0 -13
  61. package/dist/fallback/particle.d.ts +0 -2
  62. package/dist/fallback/sprite.d.ts +0 -3
  63. package/dist/fallback/utils.d.ts +0 -36
  64. package/dist/fallback.js +0 -2149
  65. package/dist/fallback.js.map +0 -1
  66. package/dist/fallback.mjs +0 -2121
  67. package/dist/fallback.mjs.map +0 -1
  68. package/dist/index.js +0 -752
  69. package/dist/index.js.map +0 -1
  70. package/dist/index.mjs +0 -737
  71. package/dist/index.mjs.map +0 -1
  72. package/dist/src/item/effect-item.d.ts +0 -17
  73. package/dist/src/item/filter-item.d.ts +0 -99
  74. /package/{dist/src → es}/constants.d.ts +0 -0
  75. /package/{dist/src → es}/item/composition-item.d.ts +0 -0
  76. /package/{dist/src → es}/item/interact-item.d.ts +0 -0
  77. /package/{dist/src → es}/item/model/binary.d.ts +0 -0
  78. /package/{dist/src → es}/item/model/index.d.ts +0 -0
  79. /package/{dist/src → es}/item/model/light.d.ts +0 -0
  80. /package/{dist/src → es}/item/model/render.d.ts +0 -0
  81. /package/{dist/src → es}/item/model/skybox.d.ts +0 -0
  82. /package/{dist/src → es}/item/model/tree.d.ts +0 -0
  83. /package/{dist/src → es}/item/null-item.d.ts +0 -0
  84. /package/{dist/src → es}/item/particle-shape.d.ts +0 -0
  85. /package/{dist/src → es}/item/plugin-item.d.ts +0 -0
  86. /package/{dist/src → es}/item/spine-item.d.ts +0 -0
  87. /package/{dist/src → es}/item/sprite-item.d.ts +0 -0
  88. /package/{dist/src → es}/item/text-item.d.ts +0 -0
package/README.md CHANGED
@@ -8,15 +8,7 @@
8
8
 
9
9
  ``` bash
10
10
  # 1. Install dependencies (first time)
11
- npm install
11
+ pnpm install
12
12
  # 2. Build
13
- npm run build
13
+ pnpm run build
14
14
  ```
15
-
16
- ## Testing
17
-
18
- ``` bash
19
- npm run test
20
- ```
21
-
22
- > Open browser and open: http://localhost:9003/test/
@@ -19,7 +19,7 @@ import type { ValueType } from './number-expression';
19
19
  */
20
20
  export type BinaryPointerContent = [index: number, start?: number, byteLength?: number, type?: BinaryType];
21
21
  export type BinaryPointer = [ValueType.BINARY, BinaryPointerContent];
22
- export type BinaryType = 'u8' | 'i8' | 'i16' | 'u16' | 'f32' | 'u32' | 'i32' | 'f64' | string;
22
+ export type BinaryType = 'u8' | 'i8' | 'i16' | 'u16' | 'f32' | 'u32' | 'i32' | 'f64' | '';
23
23
  /**
24
24
  * 线上二进制地址
25
25
  */
package/es/binary.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare class BuiltinObjectGUID {
2
+ static readonly WhiteTexture = "whitetexture00000000000000000000";
3
+ static readonly PBRShader = "pbr00000000000000000000000000000";
4
+ static readonly UnlitShader = "unlit000000000000000000000000000";
5
+ }
@@ -0,0 +1,5 @@
1
+ export class BuiltinObjectGUID {
2
+ static WhiteTexture = 'whitetexture00000000000000000000';
3
+ static PBRShader = 'pbr00000000000000000000000000000';
4
+ static UnlitShader = 'unlit000000000000000000000000000';
5
+ }
@@ -24,7 +24,7 @@ export interface DataPath {
24
24
  export interface EffectsObjectData {
25
25
  id: string;
26
26
  name?: string;
27
- dataType: string;
27
+ dataType: DataType;
28
28
  }
29
29
  export interface ComponentData extends EffectsObjectData {
30
30
  item: DataPath;
@@ -43,8 +43,8 @@ export interface Vector4Data {
43
43
  }
44
44
  export interface MaterialTextureProperty {
45
45
  texture: DataPath;
46
- offset: Vector2Data;
47
- scale: Vector2Data;
46
+ offset?: Vector2Data;
47
+ scale?: Vector2Data;
48
48
  }
49
49
  export interface MaterialData extends EffectsObjectData {
50
50
  shader: DataPath;
@@ -52,6 +52,7 @@ export interface MaterialData extends EffectsObjectData {
52
52
  zWrite?: boolean;
53
53
  zTest?: boolean;
54
54
  stringTags: Record<string, string>;
55
+ macros: string[];
55
56
  ints: Record<string, number>;
56
57
  floats: Record<string, number>;
57
58
  vector4s: Record<string, Vector4Data>;
@@ -62,8 +63,46 @@ export interface GeometryData extends EffectsObjectData {
62
63
  vertexData: VertexData;
63
64
  indexFormat: number;
64
65
  indexOffset: number;
66
+ /**
67
+ * 模型绘制模式,默认为 GeometryType.TRIANGLES(三角形)
68
+ * @default GeometryType.TRIANGLES
69
+ */
70
+ mode: GeometryType;
71
+ /**
72
+ * 存放 position, uv, normal, indices 的打包数据
73
+ */
65
74
  buffer: string;
66
75
  }
76
+ export declare enum GeometryType {
77
+ /**
78
+ * Draw single points.
79
+ */
80
+ POINTS = 0,
81
+ /**
82
+ * Draw lines. Each vertex connects to the one after it.
83
+ */
84
+ LINES = 1,
85
+ /**
86
+ * Draw lines. Each set of two vertices is treated as a separate line segment.
87
+ */
88
+ LINE_LOOP = 2,
89
+ /**
90
+ * Draw a connected group of line segments from the first vertex to the last.
91
+ */
92
+ LINE_STRIP = 3,
93
+ /**
94
+ * Draw triangles. Each set of three vertices creates a separate triangle.
95
+ */
96
+ TRIANGLES = 4,
97
+ /**
98
+ * Draw a connected strip of triangles.
99
+ */
100
+ TRIANGLE_STRIP = 5,
101
+ /**
102
+ * Draw a connected group of triangles. Each vertex connects to the previous and the first vertex in the fan.
103
+ */
104
+ TRIANGLE_FAN = 6
105
+ }
67
106
  export interface VertexData {
68
107
  vertexCount: number;
69
108
  channels: VertexChannel[];
@@ -0,0 +1,52 @@
1
+ export var DataType;
2
+ (function (DataType) {
3
+ DataType["VFXItemData"] = "VFXItemData";
4
+ DataType["EffectComponent"] = "EffectComponent";
5
+ DataType["Material"] = "Material";
6
+ DataType["Shader"] = "Shader";
7
+ DataType["SpriteComponent"] = "SpriteComponent";
8
+ DataType["ParticleSystem"] = "ParticleSystem";
9
+ DataType["InteractComponent"] = "InteractComponent";
10
+ DataType["CameraController"] = "CameraController";
11
+ DataType["Geometry"] = "Geometry";
12
+ DataType["Texture"] = "Texture";
13
+ DataType["TextComponent"] = "TextComponent";
14
+ // FIXME: 先完成ECS的场景转换,后面移到spec中
15
+ DataType["MeshComponent"] = "MeshComponent";
16
+ DataType["SkyboxComponent"] = "SkyboxComponent";
17
+ DataType["LightComponent"] = "LightComponent";
18
+ DataType["CameraComponent"] = "CameraComponent";
19
+ DataType["ModelPluginComponent"] = "ModelPluginComponent";
20
+ DataType["TreeComponent"] = "TreeComponent";
21
+ })(DataType || (DataType = {}));
22
+ export var GeometryType;
23
+ (function (GeometryType) {
24
+ /**
25
+ * Draw single points.
26
+ */
27
+ GeometryType[GeometryType["POINTS"] = 0] = "POINTS";
28
+ /**
29
+ * Draw lines. Each vertex connects to the one after it.
30
+ */
31
+ GeometryType[GeometryType["LINES"] = 1] = "LINES";
32
+ /**
33
+ * Draw lines. Each set of two vertices is treated as a separate line segment.
34
+ */
35
+ GeometryType[GeometryType["LINE_LOOP"] = 2] = "LINE_LOOP";
36
+ /**
37
+ * Draw a connected group of line segments from the first vertex to the last.
38
+ */
39
+ GeometryType[GeometryType["LINE_STRIP"] = 3] = "LINE_STRIP";
40
+ /**
41
+ * Draw triangles. Each set of three vertices creates a separate triangle.
42
+ */
43
+ GeometryType[GeometryType["TRIANGLES"] = 4] = "TRIANGLES";
44
+ /**
45
+ * Draw a connected strip of triangles.
46
+ */
47
+ GeometryType[GeometryType["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP";
48
+ /**
49
+ * Draw a connected group of triangles. Each vertex connects to the previous and the first vertex in the fan.
50
+ */
51
+ GeometryType[GeometryType["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN";
52
+ })(GeometryType || (GeometryType = {}));
@@ -4,11 +4,11 @@ export declare enum CameraClipMode {
4
4
  /**
5
5
  * 剪裁上下
6
6
  */
7
- portrait,
7
+ portrait = 1,
8
8
  /**
9
9
  * 剪裁左右
10
10
  */
11
- landscape
11
+ landscape = 0
12
12
  }
13
13
  /**
14
14
  * 相机属性
@@ -48,27 +48,27 @@ export declare enum CompositionEndBehavior {
48
48
  /**
49
49
  * 销毁
50
50
  */
51
- destroy,
51
+ destroy = 0,
52
52
  /**
53
53
  * 暂停
54
54
  */
55
- pause,
55
+ pause = 1,
56
56
  /**
57
57
  * 重播
58
58
  */
59
- restart,
59
+ restart = 5,
60
60
  /**
61
61
  * 无限播放
62
62
  */
63
- forward,
63
+ forward = 2,
64
64
  /**
65
65
  * 销毁并保留最后一帧
66
66
  */
67
- pause_destroy,
67
+ pause_destroy = 3,
68
68
  /**
69
69
  * 冻结
70
70
  */
71
- freeze
71
+ freeze = 4
72
72
  }
73
73
  /**
74
74
  * 合成信息
@@ -0,0 +1,42 @@
1
+ import { CAMERA_CLIP_MODE_NORMAL, CAMERA_CLIP_MODE_VERTICAL, END_BEHAVIOR_DESTROY, END_BEHAVIOR_FORWARD, END_BEHAVIOR_FREEZE, END_BEHAVIOR_PAUSE, END_BEHAVIOR_PAUSE_AND_DESTROY, END_BEHAVIOR_RESTART, } from './constants';
2
+ export var CameraClipMode;
3
+ (function (CameraClipMode) {
4
+ /**
5
+ * 剪裁上下
6
+ */
7
+ CameraClipMode[CameraClipMode["portrait"] = 1] = "portrait";
8
+ /**
9
+ * 剪裁左右
10
+ */
11
+ CameraClipMode[CameraClipMode["landscape"] = 0] = "landscape";
12
+ })(CameraClipMode || (CameraClipMode = {}));
13
+ /**
14
+ * 结束行为
15
+ */
16
+ export var CompositionEndBehavior;
17
+ (function (CompositionEndBehavior) {
18
+ /**
19
+ * 销毁
20
+ */
21
+ CompositionEndBehavior[CompositionEndBehavior["destroy"] = 0] = "destroy";
22
+ /**
23
+ * 暂停
24
+ */
25
+ CompositionEndBehavior[CompositionEndBehavior["pause"] = 1] = "pause";
26
+ /**
27
+ * 重播
28
+ */
29
+ CompositionEndBehavior[CompositionEndBehavior["restart"] = 5] = "restart";
30
+ /**
31
+ * 无限播放
32
+ */
33
+ CompositionEndBehavior[CompositionEndBehavior["forward"] = 2] = "forward";
34
+ /**
35
+ * 销毁并保留最后一帧
36
+ */
37
+ CompositionEndBehavior[CompositionEndBehavior["pause_destroy"] = 3] = "pause_destroy";
38
+ /**
39
+ * 冻结
40
+ */
41
+ CompositionEndBehavior[CompositionEndBehavior["freeze"] = 4] = "freeze";
42
+ })(CompositionEndBehavior || (CompositionEndBehavior = {}));
@@ -0,0 +1,11 @@
1
+ export const END_BEHAVIOR_DESTROY = 0;
2
+ export const END_BEHAVIOR_PAUSE = 1;
3
+ export const END_BEHAVIOR_FORWARD = 2;
4
+ export const END_BEHAVIOR_PAUSE_AND_DESTROY = 3;
5
+ export const END_BEHAVIOR_FREEZE = 4;
6
+ export const END_BEHAVIOR_RESTART = 5;
7
+ export const END_BEHAVIOR_DESTROY_CHILDREN = 6;
8
+ export const CAMERA_CLIP_MODE_VERTICAL = 1;
9
+ export const CAMERA_CLIP_MODE_NORMAL = 0;
10
+ export const MESSAGE_ITEM_PHRASE_BEGIN = 2;
11
+ export const MESSAGE_ITEM_PHRASE_END = 1;
@@ -1,12 +1,15 @@
1
1
  import type { RenderLevel } from './type';
2
- import type { StringTemplate } from './text';
3
2
  import type { BinaryPointer } from './binary';
3
+ import type { DataType } from './components';
4
4
  export interface TextureFormatOptions {
5
5
  format?: GLenum;
6
6
  internalFormat?: GLenum;
7
7
  type?: GLenum;
8
8
  }
9
9
  export interface TextureConfigOptionsBase {
10
+ generateMipmap?: boolean;
11
+ id?: string;
12
+ dataType?: DataType.Texture;
10
13
  name?: string;
11
14
  wrapS?: GLenum;
12
15
  wrapT?: GLenum;
@@ -41,29 +44,23 @@ export type SerializedTexture2D = SerializedTexture2DImageSource | SerializedTex
41
44
  export type SerializedTextureSource = SerializedTexture2D | SerializedTextureCube;
42
45
  export type TextureJSONOptions = SerializedTextureSource;
43
46
  export type TextureDefine = TextureJSONOptions;
44
- export interface TemplateContentBase {
45
- x?: number;
46
- y?: number;
47
+ /**
48
+ * 动态换图类型
49
+ * @since 1.1.0
50
+ */
51
+ export declare enum BackgroundType {
52
+ video = "video",
53
+ image = "image"
54
+ }
55
+ export interface TemplateContent {
47
56
  variables: Record<string, number | string>;
48
57
  /**
49
- * 当template宽高和image不相同时,会对template进行缩放,使其和image相同。
58
+ * 当 template 宽高和 image 不相同时,会对 template 进行缩放,使其和 image 相同。
50
59
  */
51
60
  width: number;
52
61
  height: number;
53
- }
54
- export interface TemplateContentV1 extends TemplateContentBase {
55
- /**
56
- * 贴图属性,svg 字段
57
- */
58
- content: string;
59
- asImage?: boolean;
60
- backgroundWidth: number;
61
- backgroundHeight: number;
62
- }
63
- export interface TemplateContentV2 extends TemplateContentBase {
64
- v: 2;
65
- content?: StringTemplate;
66
62
  background?: {
63
+ type: BackgroundType;
67
64
  name: string;
68
65
  url: string;
69
66
  };
@@ -72,6 +69,7 @@ export interface TemplateContentV2 extends TemplateContentBase {
72
69
  * 纹理贴图属性
73
70
  */
74
71
  export interface Image {
72
+ id: string;
75
73
  /**
76
74
  * 纹理贴图地址
77
75
  */
@@ -103,7 +101,7 @@ export interface Image {
103
101
  * 模板贴图属性
104
102
  */
105
103
  export interface TemplateImage extends Image {
106
- template: TemplateContentV1 | TemplateContentV2;
104
+ template: TemplateContent;
107
105
  }
108
106
  /**
109
107
  * 压缩贴图属性
@@ -117,7 +115,3 @@ export interface CompressedImage extends Image {
117
115
  pvrtc?: string;
118
116
  };
119
117
  }
120
- export interface VideoImage extends Image {
121
- type: 'video';
122
- loop?: boolean;
123
- }
package/es/image.js ADDED
@@ -0,0 +1,9 @@
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 = {}));
@@ -1,4 +1,3 @@
1
- export * from 'uuid/dist/esm-browser/v4';
2
1
  export * from './type';
3
2
  export * from './composition';
4
3
  export * from './image';
@@ -16,10 +15,12 @@ export * from './item/particle-shape';
16
15
  export * from './item/plugin-item';
17
16
  export * from './item/sprite-item';
18
17
  export * from './item/spine-item';
19
- export * from './item/filter-item';
18
+ export * from './item/effect-item';
20
19
  export * from './item/text-item';
21
20
  export * from './item/model';
21
+ export * from './vfx-item-data';
22
22
  export * from './binary';
23
23
  export * from './text';
24
24
  export * from './components';
25
25
  export * from './vfx-item-data';
26
+ export * from './buitin-object-guid';
package/es/index.js ADDED
@@ -0,0 +1,26 @@
1
+ export * from './type';
2
+ export * from './composition';
3
+ export * from './image';
4
+ export * from './constants';
5
+ export * from './number-expression';
6
+ export * from './scene';
7
+ export * from './item';
8
+ export * from './item/base-item';
9
+ export * from './item/camera-item';
10
+ export * from './item/composition-item';
11
+ export * from './item/interact-item';
12
+ export * from './item/null-item';
13
+ export * from './item/particle-item';
14
+ export * from './item/particle-shape';
15
+ export * from './item/plugin-item';
16
+ export * from './item/sprite-item';
17
+ export * from './item/spine-item';
18
+ export * from './item/effect-item';
19
+ export * from './item/text-item';
20
+ export * from './item/model';
21
+ export * from './vfx-item-data';
22
+ export * from './binary';
23
+ export * from './text';
24
+ export * from './components';
25
+ export * from './vfx-item-data';
26
+ export * from './buitin-object-guid';
@@ -1,21 +1,24 @@
1
- import type { FilterContent } from './filter-item';
1
+ import type { BinaryEnv } from '../binary';
2
2
  import type { vec3, vec4 } from '../number-expression';
3
3
  import type { ItemType, RenderLevel } from '../type';
4
4
  import type { CameraContent } from './camera-item';
5
5
  import type { CompositionContent } from './composition-item';
6
+ import type { EffectContent } from './effect-item';
6
7
  import type { InteractContent } from './interact-item';
8
+ import type { ModelLightContent, ModelMeshItemContent, ModelTreeContent, SkyboxContent } from './model';
7
9
  import type { NullContent } from './null-item';
8
10
  import type { ParticleContent } from './particle-item';
9
11
  import type { PluginContent } from './plugin-item';
12
+ import type { SpineContent } from './spine-item';
10
13
  import type { SpriteContent } from './sprite-item';
11
14
  import type { TextContent } from './text-item';
12
15
  export declare enum ItemEndBehavior {
13
- destroy,
14
- loop,
15
- freeze
16
+ destroy = 0,
17
+ loop = 5,
18
+ freeze = 4
16
19
  }
17
20
  export declare enum ParentItemEndBehavior {
18
- destroyChildren
21
+ destroyChildren = 6
19
22
  }
20
23
  export interface BaseItem {
21
24
  /**
@@ -123,4 +126,4 @@ export interface TransformData {
123
126
  size?: Vector2Data;
124
127
  anchor?: Vector2Data;
125
128
  }
126
- export type BaseContent = SpriteContent | ParticleContent | NullContent | InteractContent | PluginContent | CompositionContent | CameraContent | FilterContent | TextContent | any;
129
+ export type BaseContent = SpriteContent | ParticleContent | NullContent | InteractContent | PluginContent | CompositionContent | CameraContent | TextContent | SpineContent | EffectContent | ModelTreeContent<BinaryEnv> | ModelMeshItemContent<BinaryEnv> | ModelLightContent | SkyboxContent<BinaryEnv> | any;
@@ -0,0 +1,11 @@
1
+ import { END_BEHAVIOR_DESTROY, END_BEHAVIOR_DESTROY_CHILDREN, END_BEHAVIOR_FREEZE, END_BEHAVIOR_RESTART, } from '../constants';
2
+ export var ItemEndBehavior;
3
+ (function (ItemEndBehavior) {
4
+ ItemEndBehavior[ItemEndBehavior["destroy"] = 0] = "destroy";
5
+ ItemEndBehavior[ItemEndBehavior["loop"] = 5] = "loop";
6
+ ItemEndBehavior[ItemEndBehavior["freeze"] = 4] = "freeze";
7
+ })(ItemEndBehavior || (ItemEndBehavior = {}));
8
+ export var ParentItemEndBehavior;
9
+ (function (ParentItemEndBehavior) {
10
+ ParentItemEndBehavior[ParentItemEndBehavior["destroyChildren"] = 6] = "destroyChildren";
11
+ })(ParentItemEndBehavior || (ParentItemEndBehavior = {}));
@@ -35,7 +35,7 @@ export interface CameraContent {
35
35
  */
36
36
  clipMode?: CameraClipMode;
37
37
  /**
38
- * 默认不提供,等于canvas width/height
38
+ * 默认不提供,等于 canvas width/height
39
39
  */
40
40
  aspect?: number;
41
41
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ import type { ItemType, PositionOverLifetime, RotationOverLifetime, SizeOverLifetime } from '../type';
2
+ import type { BaseItem, ItemEndBehavior } from './base-item';
3
+ /**
4
+ * 特效元素
5
+ */
6
+ export interface EffectItem extends BaseItem {
7
+ type: ItemType.effect;
8
+ content: EffectContent;
9
+ endBehavior: ItemEndBehavior;
10
+ }
11
+ /**
12
+ * 特效元素属性
13
+ */
14
+ export interface EffectContent {
15
+ /**
16
+ * 特效元素材质数据索引组
17
+ */
18
+ materials: number[];
19
+ /**
20
+ * 特效元素几何数据索引
21
+ */
22
+ geometry: number;
23
+ /**
24
+ * 特效元素大小变化属性
25
+ */
26
+ sizeOverLifetime?: SizeOverLifetime;
27
+ /**
28
+ * 特效元素旋转变化属性
29
+ */
30
+ rotationOverLifetime?: RotationOverLifetime;
31
+ /**
32
+ * 特效元素位置变化属性
33
+ */
34
+ positionOverLifetime?: PositionOverLifetime;
35
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -32,25 +32,41 @@ export interface ModelCameraItem extends BaseItem {
32
32
  content: ModelCameraContent;
33
33
  endBehavior: ItemEndBehavior;
34
34
  }
35
+ export declare enum CameraType {
36
+ orthographic = "orthographic",
37
+ perspective = "perspective"
38
+ }
35
39
  export interface ModelCameraComponentData extends ComponentData {
40
+ /**
41
+ * 相机类型,默认是透视相机
42
+ */
43
+ type?: CameraType;
36
44
  /**
37
45
  * 视角属性
38
46
  */
39
- fov: number;
47
+ fov?: number;
40
48
  /**
41
49
  * 相机远平面
42
50
  */
43
- far: number;
51
+ far?: number;
44
52
  /**
45
53
  * 相机近平面
46
54
  */
47
- near: number;
55
+ near?: number;
48
56
  /**
49
57
  * 默认不提供,等于 canvas 的 `width/height`
50
58
  */
51
59
  aspect?: number;
60
+ /**
61
+ * x轴上范围(正交相机)
62
+ */
63
+ xmag?: number;
64
+ /**
65
+ * y轴上范围(正交相机)
66
+ */
67
+ ymag?: number;
52
68
  /**
53
69
  * 相机剪裁模式
54
70
  */
55
- clipMode: CameraClipMode;
71
+ clipMode?: CameraClipMode;
56
72
  }
@@ -0,0 +1,5 @@
1
+ export var CameraType;
2
+ (function (CameraType) {
3
+ CameraType["orthographic"] = "orthographic";
4
+ CameraType["perspective"] = "perspective";
5
+ })(CameraType || (CameraType = {}));
@@ -0,0 +1,35 @@
1
+ export * from './skybox';
2
+ export * from './light';
3
+ export * from './mesh';
4
+ export * from './tree';
5
+ export * from './camera';
6
+ export * from './material';
7
+ export * from './binary';
8
+ export * from './render';
9
+ /***
10
+ * 一个 meshItem 打包出来的 json 案例:
11
+ *
12
+ * {
13
+ * type:'mesh',
14
+ * pluginName:'model',
15
+ * content:{
16
+ * options:{
17
+ * skins:{},
18
+ * primitives:[
19
+ * {
20
+ * material:{
21
+ * baseColorFactor:[0,0.5,1,1],
22
+ * baseColorTexture: {
23
+ * magFilter:33071,
24
+ * imageFileId:[0,556,1342]
25
+ * }
26
+ * },
27
+ * geometry:[0,0,556]
28
+ * }
29
+ * ]
30
+ * }
31
+ *
32
+ * }
33
+ * }
34
+ * bins:[{url:'https://to/some/bin'}]
35
+ */
@@ -0,0 +1,19 @@
1
+ export var LightType;
2
+ (function (LightType) {
3
+ /**
4
+ * 点光源
5
+ */
6
+ LightType["point"] = "point";
7
+ /**
8
+ * 聚光灯
9
+ */
10
+ LightType["spot"] = "spot";
11
+ /**
12
+ * 方向光
13
+ */
14
+ LightType["directional"] = "directional";
15
+ /**
16
+ * 环境光
17
+ */
18
+ LightType["ambient"] = "ambient";
19
+ })(LightType || (LightType = {}));
@@ -13,9 +13,9 @@ export declare enum MaterialType {
13
13
  hair = "hair"
14
14
  }
15
15
  export declare enum MaterialBlending {
16
- opaque = 100,
17
- masked = 101,
18
- translucent = 102,
16
+ opaque = 100,// 不透明
17
+ masked = 101,// 遮罩
18
+ translucent = 102,// 半透明
19
19
  additive = 103
20
20
  }
21
21
  export type MaterialOptions<T extends BinaryEnv> = MaterialUnlitOptions<T> | MaterialPBROptions<T>;
@@ -0,0 +1,16 @@
1
+ // 材质类型
2
+ export var MaterialType;
3
+ (function (MaterialType) {
4
+ MaterialType["unlit"] = "unlit";
5
+ MaterialType["pbr"] = "pbr";
6
+ // 头发材质,在 pbr 材质基础上扩展
7
+ MaterialType["hair"] = "hair";
8
+ })(MaterialType || (MaterialType = {}));
9
+ // 混合模式
10
+ export var MaterialBlending;
11
+ (function (MaterialBlending) {
12
+ MaterialBlending[MaterialBlending["opaque"] = 100] = "opaque";
13
+ MaterialBlending[MaterialBlending["masked"] = 101] = "masked";
14
+ MaterialBlending[MaterialBlending["translucent"] = 102] = "translucent";
15
+ MaterialBlending[MaterialBlending["additive"] = 103] = "additive";
16
+ })(MaterialBlending || (MaterialBlending = {}));