@galacean/effects-plugin-model 1.2.3 → 2.0.0-alpha.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 (41) hide show
  1. package/dist/gesture/index.d.ts +5 -4
  2. package/dist/gltf/loader-helper.d.ts +1 -3
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.js +8358 -6785
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.js +2 -2
  7. package/dist/index.mjs +8357 -6784
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/loader.mjs +10070 -4913
  10. package/dist/loader.mjs.map +1 -1
  11. package/dist/plugin/const.d.ts +3 -0
  12. package/dist/plugin/index.d.ts +0 -2
  13. package/dist/plugin/model-item.d.ts +258 -0
  14. package/dist/plugin/model-plugin.d.ts +91 -18
  15. package/dist/plugin/model-tree-item.d.ts +113 -6
  16. package/dist/plugin/model-tree-plugin.d.ts +9 -8
  17. package/dist/runtime/anim-sampler.d.ts +20 -0
  18. package/dist/runtime/animation.d.ts +179 -26
  19. package/dist/runtime/cache.d.ts +75 -0
  20. package/dist/runtime/camera.d.ts +130 -5
  21. package/dist/runtime/common.d.ts +143 -4
  22. package/dist/runtime/light.d.ts +95 -6
  23. package/dist/runtime/material.d.ts +306 -1
  24. package/dist/runtime/math.d.ts +2 -0
  25. package/dist/runtime/mesh.d.ts +242 -32
  26. package/dist/runtime/object.d.ts +88 -10
  27. package/dist/runtime/scene.d.ts +156 -27
  28. package/dist/runtime/shader-libs/standard-shader-source.d.ts +10 -0
  29. package/dist/runtime/shader-libs/standard-shader.d.ts +16 -0
  30. package/dist/runtime/shader.d.ts +33 -1
  31. package/dist/runtime/skybox.d.ts +233 -9
  32. package/dist/utility/debug-helper.d.ts +14 -0
  33. package/dist/utility/hit-test-helper.d.ts +39 -3
  34. package/dist/utility/plugin-helper.d.ts +665 -14
  35. package/dist/utility/ri-helper.d.ts +67 -0
  36. package/dist/utility/shader-helper.d.ts +55 -0
  37. package/dist/utility/ts-helper.d.ts +6 -0
  38. package/package.json +4 -4
  39. package/dist/plugin/model-tree-vfx-item.d.ts +0 -15
  40. package/dist/plugin/model-vfx-item.d.ts +0 -28
  41. package/dist/runtime/shadow.d.ts +0 -230
@@ -1,8 +1,9 @@
1
- import type { math } from '@galacean/effects';
2
1
  import { Transform as EffectsTransform, spec } from '@galacean/effects';
3
2
  import { Quaternion, Euler, Vector3, Matrix4 } from './math';
4
3
  import type { BaseTransform } from '../index';
5
- type Euler = math.Euler;
4
+ /**
5
+ * Model 插件中的对象类型
6
+ */
6
7
  export declare enum PObjectType {
7
8
  none = 0,
8
9
  mesh = 1,
@@ -18,18 +19,27 @@ export declare enum PObjectType {
18
19
  animationManager = 11,
19
20
  reference = 12
20
21
  }
22
+ /**
23
+ * 灯光类型
24
+ */
21
25
  export declare enum PLightType {
22
26
  directional = 0,
23
27
  point = 1,
24
28
  spot = 2,
25
29
  ambient = 3
26
30
  }
31
+ /**
32
+ * 纹理类型
33
+ */
27
34
  export declare enum PTextureType {
28
35
  none = 0,
29
36
  t2d = 1,
30
37
  t3d = 2,
31
38
  cube = 3
32
39
  }
40
+ /**
41
+ * 材质类型
42
+ */
33
43
  export declare enum PMaterialType {
34
44
  none = 0,
35
45
  unlit = 1,
@@ -40,12 +50,18 @@ export declare enum PMaterialType {
40
50
  shadowFilter = 6,
41
51
  skyboxFilter = 7
42
52
  }
53
+ /**
54
+ * 混合模式
55
+ */
43
56
  export declare enum PBlendMode {
44
57
  opaque = 0,
45
58
  masked = 1,
46
59
  translucent = 2,
47
60
  additive = 3
48
61
  }
62
+ /**
63
+ * 面片朝向模式
64
+ */
49
65
  export declare enum PFaceSideMode {
50
66
  both = 0,
51
67
  front = 1,
@@ -57,39 +73,145 @@ export declare enum PShadowType {
57
73
  variance = 2,
58
74
  expVariance = 3
59
75
  }
76
+ /**
77
+ * 插件变换类
78
+ */
60
79
  export declare class PTransform {
61
80
  private translation;
62
81
  private rotation;
63
82
  private scale;
83
+ /**
84
+ * 从矩阵设置数据
85
+ * @param matrix - 4阶矩阵
86
+ * @returns
87
+ */
64
88
  fromMatrix4(matrix: Matrix4): this;
89
+ /**
90
+ * 从 GE 变换设置数据
91
+ * @param trans - GE 变换对象或数据
92
+ * @returns
93
+ */
65
94
  fromEffectsTransform(trans: EffectsTransform | BaseTransform): this;
95
+ /**
96
+ * 转成 GE 变换对象
97
+ * @param transform - GE 变换对象
98
+ * @returns
99
+ */
66
100
  toEffectsTransform(transform: EffectsTransform): EffectsTransform;
101
+ /**
102
+ * 通过 GE 变换参数设置
103
+ * @param trans - GE 变换参数
104
+ * @returns
105
+ */
67
106
  fromBaseTransform(trans: BaseTransform): this;
107
+ /**
108
+ * 获取平移
109
+ * @returns
110
+ */
68
111
  getTranslation(): Vector3;
112
+ /**
113
+ * 设置平移
114
+ * @param val - 平移
115
+ */
69
116
  setTranslation(val: Vector3 | spec.vec3): void;
117
+ /**
118
+ * 获取位置
119
+ * @returns
120
+ */
70
121
  getPosition(): Vector3;
122
+ /**
123
+ * 设置位置
124
+ * @param val - 位置
125
+ */
71
126
  setPosition(val: Vector3 | spec.vec3): void;
127
+ /**
128
+ * 获取旋转
129
+ * @returns
130
+ */
72
131
  getRotation(): Quaternion;
132
+ /**
133
+ * 设置旋转
134
+ * @param val - 旋转,可能是四元数或欧拉角
135
+ */
73
136
  setRotation(val: Quaternion | Euler | Vector3 | spec.vec4 | spec.vec3): void;
137
+ /**
138
+ * 获取缩放
139
+ * @returns
140
+ */
74
141
  getScale(): Vector3;
142
+ /**
143
+ * 设置缩放
144
+ * @param val - 缩放
145
+ */
75
146
  setScale(val: Vector3 | spec.vec3): void;
147
+ /**
148
+ * 获取矩阵
149
+ * @returns
150
+ */
76
151
  getMatrix(): Matrix4;
152
+ /**
153
+ * 设置矩阵
154
+ * @param mat - 4阶矩阵
155
+ */
77
156
  setMatrix(mat: Matrix4 | spec.mat4): void;
78
157
  }
158
+ /**
159
+ * 坐标系类
160
+ */
79
161
  export declare class PCoordinate {
162
+ /**
163
+ * 原点
164
+ */
80
165
  origin: Vector3;
166
+ /**
167
+ * X 轴
168
+ */
81
169
  xAxis: Vector3;
170
+ /**
171
+ * Y 轴
172
+ */
82
173
  yAxis: Vector3;
174
+ /**
175
+ * Z 轴
176
+ */
83
177
  zAxis: Vector3;
84
178
  constructor();
179
+ /**
180
+ * 从插件变换创建坐标系
181
+ * @param trans - 变换
182
+ * @param invert - 是否旋转取反
183
+ * @returns 坐标系对象
184
+ */
85
185
  fromPTransform(trans: PTransform, invert?: boolean): this;
186
+ /**
187
+ * 从旋转矩阵创建坐标系
188
+ * @param matrix - 矩阵
189
+ */
86
190
  fromRotationMatrix(matrix: Matrix4): void;
87
191
  }
192
+ /**
193
+ * 全局状态
194
+ */
88
195
  export declare class PGlobalState {
196
+ /**
197
+ * 是否 WebGL2
198
+ */
89
199
  isWebGL2: boolean;
200
+ /**
201
+ * 是否共享 Shader
202
+ */
90
203
  shaderShared: boolean;
204
+ /**
205
+ * 运行时环境,编辑器模式或设备模式
206
+ */
91
207
  runtimeEnv: string;
208
+ /**
209
+ * 兼容模式,glTF 模式或 Tiny3d 模式
210
+ */
92
211
  compatibleMode: string;
212
+ /**
213
+ * 是否显示包围盒
214
+ */
93
215
  visBoundingBox: boolean;
94
216
  /**
95
217
  * 渲染输出结果模式,可以换中间渲染数据
@@ -100,17 +222,34 @@ export declare class PGlobalState {
100
222
  */
101
223
  renderMode3DUVGridSize: number;
102
224
  private static instance;
225
+ /**
226
+ * 获取单例
227
+ * @returns
228
+ */
103
229
  static getInstance(): PGlobalState;
104
230
  private constructor();
231
+ /**
232
+ * 重置数据
233
+ */
105
234
  reset(): void;
106
235
  /**
107
236
  * 是否可视化渲染中间结果
108
237
  */
109
238
  hasRenderMode3D(): boolean;
239
+ /**
240
+ * 是否编辑器模式
241
+ */
110
242
  get isEditorEnv(): boolean;
243
+ /**
244
+ * 是否设备模式
245
+ */
111
246
  get isDeviceEnv(): boolean;
247
+ /**
248
+ * 是否 Tiny3d 模式
249
+ */
112
250
  get isTiny3dMode(): boolean;
113
- get isOasisMode(): boolean;
251
+ /**
252
+ * 是否 glTF 模式
253
+ */
114
254
  get isGLTFMode(): boolean;
115
255
  }
116
- export {};
@@ -1,34 +1,123 @@
1
- import type { ModelItemLight } from '../index';
1
+ import type { ModelLightOptions } from '../index';
2
2
  import { Vector2, Vector3 } from './math';
3
3
  import { PLightType } from './common';
4
4
  import { PEntity } from './object';
5
- import type { ModelVFXItem } from '../plugin/model-vfx-item';
5
+ import type { ModelLightComponent } from '../plugin/model-item';
6
+ /**
7
+ * 灯光类,支持 3D 场景中的灯光功能
8
+ */
6
9
  export declare class PLight extends PEntity {
10
+ /**
11
+ * 所属的灯光组件
12
+ */
13
+ owner?: ModelLightComponent;
14
+ /**
15
+ * 方向,仅用于方向光和聚光灯
16
+ */
7
17
  direction: Vector3;
18
+ /**
19
+ * 范围,仅用于点光源和聚光灯
20
+ */
8
21
  range: number;
22
+ /**
23
+ * 颜色
24
+ */
9
25
  color: Vector3;
26
+ /**
27
+ * 强度
28
+ */
10
29
  intensity: number;
30
+ /**
31
+ * 聚光灯外径
32
+ */
11
33
  outerConeAngle: number;
34
+ /**
35
+ * 聚光灯内径
36
+ */
12
37
  innerConeAngle: number;
38
+ /**
39
+ * 类型
40
+ */
13
41
  lightType: PLightType;
14
42
  padding: Vector2;
15
- constructor(light: ModelItemLight, ownerItem?: ModelVFXItem);
16
- tick(deltaSeconds: number): void;
43
+ /**
44
+ * 创建灯光对象
45
+ * @param light - 灯光参数
46
+ * @param ownerI - 所属灯光组件
47
+ */
48
+ constructor(name: string, options: ModelLightOptions, owner?: ModelLightComponent);
49
+ /**
50
+ * 更新灯光变换
51
+ */
52
+ update(): void;
53
+ /**
54
+ * 是否方向光
55
+ * @returns
56
+ */
17
57
  isDirectional(): boolean;
58
+ /**
59
+ * 是否点光源
60
+ * @returns
61
+ */
18
62
  isPoint(): boolean;
63
+ /**
64
+ * 是否聚光灯
65
+ * @returns
66
+ */
19
67
  isSpot(): boolean;
68
+ /**
69
+ * 是否环境光
70
+ * @returns
71
+ */
20
72
  isAmbient(): boolean;
73
+ /**
74
+ * 获取位置
75
+ */
21
76
  get position(): Vector3;
77
+ /**
78
+ * 获取世界坐标中的位置
79
+ * @returns
80
+ */
22
81
  getWorldPosition(): Vector3;
82
+ /**
83
+ * 获取世界坐标中的方向
84
+ * @returns
85
+ */
23
86
  getWorldDirection(): Vector3;
24
87
  }
88
+ /**
89
+ * 灯光管理类,负责 3D 场景灯光的管理
90
+ */
25
91
  export declare class PLightManager {
92
+ /**
93
+ * 灯光数组
94
+ */
26
95
  lightList: PLight[];
27
96
  constructor();
28
- tick(deltaSeconds: number): void;
29
- insertItem(inLight: ModelItemLight, ownerItem?: ModelVFXItem): PLight;
97
+ /**
98
+ * 通过灯光参数,创建灯光对象,并保存到灯光数组中
99
+ * @param inLight - 灯光参数
100
+ * @param owner - 所属灯光组件
101
+ * @returns 插入的灯光对象
102
+ */
103
+ insertItem(name: string, inLight: ModelLightOptions, owner?: ModelLightComponent): PLight;
104
+ /**
105
+ * 插入灯光对象
106
+ * @param inLight - 灯光对象
107
+ * @returns 插入的灯光对象
108
+ */
30
109
  insertLight(inLight: PLight): PLight;
110
+ /**
111
+ * 删除灯光对象,从灯光数组中查找对象并进行删除,如果没有找到就忽略
112
+ * @param inLight - 删除的灯光对象
113
+ */
31
114
  remove(inLight: PLight): void;
115
+ /**
116
+ * 销毁
117
+ */
32
118
  dispose(): void;
119
+ /**
120
+ * 灯光数目
121
+ */
33
122
  get lightCount(): number;
34
123
  }