@galacean/effects-plugin-model 1.2.0 → 2.0.0-alpha.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 (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
@@ -4,98 +4,403 @@ import type { ModelMaterialOptions, ModelMaterialUnlitOptions, ModelMaterialPBRO
4
4
  import { Vector3, Vector4, Matrix3 } from './math';
5
5
  import { PMaterialType, PBlendMode, PFaceSideMode } from './common';
6
6
  import { PObject } from './object';
7
+ /**
8
+ * 3D 材质基础类,支持公共的材质功能
9
+ */
7
10
  export declare abstract class PMaterialBase extends PObject {
11
+ /**
12
+ * 材质类型,主要是 pbr 和 unlit 两类
13
+ */
8
14
  materialType: PMaterialType;
15
+ /**
16
+ * 顶点着色器代码
17
+ */
9
18
  vertexShaderCode: string;
19
+ /**
20
+ * 片段着色器代码
21
+ */
10
22
  fragmentShaderCode: string;
11
23
  /**
12
- * 深度是否写入,默认是写入(true)
24
+ * 深度是否写入,默认是写入
13
25
  */
14
26
  depthMask: boolean;
27
+ /**
28
+ * 是否深度测试提示,默认开启
29
+ */
15
30
  depthTestHint: boolean;
31
+ /**
32
+ * 混合模式,默认是不透明
33
+ */
16
34
  blendMode: PBlendMode;
35
+ /**
36
+ * Alpha 测试截断值
37
+ */
17
38
  alphaCutOff: number;
39
+ /**
40
+ * 面侧模式,默认是正面
41
+ */
18
42
  faceSideMode: PFaceSideMode;
43
+ /**
44
+ * 获取着色器特性列表,根据材质状态
45
+ * @returns 特性列表
46
+ */
19
47
  getShaderFeatures(): string[];
48
+ /**
49
+ * 根据材质状态,更新 GE 材质状态
50
+ * @param material - GE 材质
51
+ */
20
52
  updateUniforms(material: Material): void;
53
+ /**
54
+ * 生成顶点和片段着色器代码
55
+ * 先获取着色器特性,再根据材质和全局状态,生成着色器代码
56
+ * @param inFeatureList - 外部特性列表
57
+ */
21
58
  build(inFeatureList?: string[]): void;
59
+ /**
60
+ * 获取混合模式,根据 GE 混合模式
61
+ * @param mode - GE 混合模式
62
+ * @returns
63
+ */
22
64
  getBlendMode(mode?: spec.MaterialBlending): PBlendMode;
65
+ /**
66
+ * 获取面侧模式,根据 GE 面侧模式
67
+ * @param mode - GE 面侧模式
68
+ * @returns
69
+ */
23
70
  getFaceSideMode(mode?: spec.SideMode): PFaceSideMode;
71
+ /**
72
+ * 设置材质状态,根据 GE 材质状态
73
+ * @param material - GE 材质
74
+ */
24
75
  setMaterialStates(material: Material): void;
25
76
  protected setFaceSideStates(material: Material): void;
77
+ /**
78
+ * 销毁材质,清除着色器代码
79
+ */
26
80
  dispose(): void;
81
+ /**
82
+ * 是否合法,材质类型非 none
83
+ * @returns
84
+ */
27
85
  isValid(): boolean;
86
+ /**
87
+ * 是否不透明
88
+ * @returns
89
+ */
28
90
  isOpaque(): boolean;
91
+ /**
92
+ * 是否遮罩
93
+ * @returns
94
+ */
29
95
  isMasked(): boolean;
96
+ /**
97
+ * 是否半透明
98
+ * @returns
99
+ */
30
100
  isTranslucent(): boolean;
101
+ /**
102
+ * 是否加法混合
103
+ * @returns
104
+ */
31
105
  isAdditive(): boolean;
106
+ /**
107
+ * 是否需要混合
108
+ * @returns
109
+ */
32
110
  requireBlend(): boolean;
111
+ /**
112
+ * 是否正面模式
113
+ * @returns
114
+ */
33
115
  isFrontFace(): boolean;
116
+ /**
117
+ * 是否背面模式
118
+ * @returns
119
+ */
34
120
  isBackFace(): boolean;
121
+ /**
122
+ * 是否双面模式
123
+ * @returns
124
+ */
35
125
  isBothFace(): boolean;
36
126
  }
127
+ /**
128
+ * 无光照材质类,负责无关照或者不接受光照情况下的物体材质效果
129
+ */
37
130
  export declare class PMaterialUnlit extends PMaterialBase {
38
131
  private baseColorFactor;
39
132
  private baseColorTexture?;
133
+ /**
134
+ * 创建无光照材质,支持基础颜色纹理
135
+ * @param options - 无光照材质参数
136
+ */
40
137
  create(options: ModelMaterialUnlitOptions): void;
138
+ /**
139
+ * 销毁材质
140
+ */
41
141
  dispose(): void;
142
+ /**
143
+ * 获取着色器特性列表,根据材质状态
144
+ * @returns 着色器特性列表
145
+ */
42
146
  getShaderFeatures(): string[];
147
+ /**
148
+ * 更新对应的 GE 材质中着色器的 Uniform 数据
149
+ * @param material - GE 材质
150
+ */
43
151
  updateUniforms(material: Material): void;
152
+ /**
153
+ * 是否有基础颜色纹理
154
+ * @returns
155
+ */
44
156
  hasBaseColorTexture(): boolean;
157
+ /**
158
+ * 获取基础颜色纹理
159
+ * @returns
160
+ */
45
161
  getBaseColorTexture(): Texture;
162
+ /**
163
+ * 设置基础颜色纹理
164
+ * @param val - 纹理对象
165
+ */
46
166
  setBaseColorTexture(val: Texture): void;
167
+ /**
168
+ * 获取基础颜色值
169
+ * @returns
170
+ */
47
171
  getBaseColorFactor(): Vector4;
172
+ /**
173
+ * 设置基础颜色值
174
+ * @param val - 颜色值
175
+ */
48
176
  setBaseColorFactor(val: Vector4 | spec.vec4): void;
49
177
  }
178
+ /**
179
+ * PBR 材质类,负责基于物理的材质效果,也是渲染中最常用的材质。
180
+ * 目前支持金属度/粗糙度工作流,与其他引擎中的 PBR 材质功能一致。
181
+ */
50
182
  export declare class PMaterialPBR extends PMaterialBase {
183
+ /**
184
+ * 基础颜色纹理
185
+ */
51
186
  baseColorTexture?: Texture;
187
+ /**
188
+ * 基础颜色纹理变换
189
+ */
52
190
  baseColorTextureTrans?: Matrix3;
191
+ /**
192
+ * 基础颜色值,默认是白色 Vector4(1, 1, 1, 1)
193
+ */
53
194
  baseColorFactor: Vector4;
195
+ /**
196
+ * 金属度粗超度纹理
197
+ */
54
198
  metallicRoughnessTexture?: Texture;
199
+ /**
200
+ * 金属度粗超度纹理变换
201
+ */
55
202
  metallicRoughnessTextureTrans?: Matrix3;
203
+ /**
204
+ * 是否高光抗锯齿,能够明显提升高光表现效果
205
+ */
56
206
  useSpecularAA: boolean;
207
+ /**
208
+ * 金属度值
209
+ */
57
210
  metallicFactor: number;
211
+ /**
212
+ * 粗超度值
213
+ */
58
214
  roughnessFactor: number;
215
+ /**
216
+ * 法线纹理
217
+ */
59
218
  normalTexture?: Texture;
219
+ /**
220
+ * 法线纹理变换
221
+ */
60
222
  normalTextureTrans?: Matrix3;
223
+ /**
224
+ * 法线纹理缩放
225
+ */
61
226
  normalTextureScale: number;
227
+ /**
228
+ * AO 纹理
229
+ */
62
230
  occlusionTexture?: Texture;
231
+ /**
232
+ * AO 纹理变换
233
+ */
63
234
  occlusionTextureTrans?: Matrix3;
235
+ /**
236
+ * AO 纹理强度
237
+ */
64
238
  occlusionTextureStrength: number;
239
+ /**
240
+ * 自发光纹理
241
+ */
65
242
  emissiveTexture?: Texture;
243
+ /**
244
+ * 自发光纹理变换
245
+ */
66
246
  emissiveTextureTrans?: Matrix3;
247
+ /**
248
+ * 自发光颜色值,默认是黑色 Vector3(0, 0, 0)
249
+ */
67
250
  emissiveFactor: Vector3;
251
+ /**
252
+ * 自发光强度
253
+ */
68
254
  emissiveIntensity: number;
69
255
  enableShadow: boolean;
256
+ /**
257
+ * 创建材质
258
+ * @param options - PBR 材质参数
259
+ */
70
260
  create(options: ModelMaterialPBROptions): void;
261
+ /**
262
+ * 销毁材质
263
+ */
71
264
  dispose(): void;
265
+ /**
266
+ * 获取材质特性列表
267
+ * @returns 材质特性列表
268
+ */
72
269
  getShaderFeatures(): string[];
270
+ /**
271
+ * 更新关联的 GE 材质中着色器的 Uniform 数据
272
+ * @param material - GE 材质
273
+ */
73
274
  updateUniforms(material: Material): void;
275
+ /**
276
+ * 是否有基础颜色纹理
277
+ * @returns
278
+ */
74
279
  hasBaseColorTexture(): boolean;
280
+ /**
281
+ * 是否有基础颜色纹理变换
282
+ * @returns
283
+ */
75
284
  hasBaseColorTextureTrans(): boolean;
285
+ /**
286
+ * 设置基础颜色纹理
287
+ * @param val - 纹理
288
+ */
76
289
  setBaseColorTexture(val: Texture): void;
290
+ /**
291
+ * 获取基础颜色纹理
292
+ * @returns
293
+ */
77
294
  getBaseColorFactor(): Vector4;
295
+ /**
296
+ * 设置基础颜色值
297
+ * @param val - 颜色值
298
+ */
78
299
  setBaseColorFactor(val: Vector4 | spec.vec4): void;
300
+ /**
301
+ * 是否有金属度粗超度纹理
302
+ * @returns
303
+ */
79
304
  hasMetallicRoughnessTexture(): boolean;
305
+ /**
306
+ * 是否有金属度粗超度纹理坐标变换
307
+ * @returns
308
+ */
80
309
  hasMetallicRoughnessTextureTrans(): boolean;
310
+ /**
311
+ * 获取金属度粗超度纹理
312
+ * @returns
313
+ */
81
314
  getMetallicRoughnessTexture(): Texture;
315
+ /**
316
+ * 设置金属度粗超度纹理
317
+ * @param val - 纹理
318
+ */
82
319
  setMetallicRoughnessTexture(val: Texture): void;
320
+ /**
321
+ * 是否有法线纹理
322
+ * @returns
323
+ */
83
324
  hasNormalTexture(): boolean;
325
+ /**
326
+ * 是否有法线纹理坐标变换
327
+ * @returns
328
+ */
84
329
  hasNormalTextureTrans(): boolean;
330
+ /**
331
+ * 获取法线纹理
332
+ * @returns
333
+ */
85
334
  getNormalTexture(): Texture;
335
+ /**
336
+ * 设置法线纹理
337
+ * @param val - 纹理
338
+ */
86
339
  setNormalTexture(val: Texture): void;
340
+ /**
341
+ * 是否有遮挡纹理
342
+ * @returns
343
+ */
87
344
  hasOcclusionTexture(): boolean;
345
+ /**
346
+ * 是否有遮挡纹理坐标变换
347
+ * @returns
348
+ */
88
349
  hasOcclusionTextureTrans(): boolean;
350
+ /**
351
+ * 获取遮挡纹理
352
+ * @returns
353
+ */
89
354
  getOcclusionTexture(): Texture;
355
+ /**
356
+ * 设置遮挡纹理
357
+ * @param val - 纹理
358
+ */
90
359
  setOcclusionTexture(val: Texture): void;
360
+ /**
361
+ * 是否有自发光纹理
362
+ * @returns
363
+ */
91
364
  hasEmissiveTexture(): boolean;
365
+ /**
366
+ * 是否有自发光纹理坐标变换
367
+ * @returns
368
+ */
92
369
  hasEmissiveTextureTrans(): boolean;
370
+ /**
371
+ * 获取自发光纹理
372
+ * @returns
373
+ */
93
374
  getEmissiveTexture(): Texture;
375
+ /**
376
+ * 设置自发光纹理
377
+ * @param val - 纹理
378
+ */
94
379
  setEmissiveTexture(val: Texture): void;
380
+ /**
381
+ * 是否有自发光颜色,包含强度
382
+ * @returns
383
+ */
95
384
  hasEmissiveFactor(): boolean;
385
+ /**
386
+ * 获取自发光颜色,包含强度
387
+ * @returns
388
+ */
96
389
  getEmissiveFactor(): Vector3;
390
+ /**
391
+ * 设置自发光颜色
392
+ * @param val - 颜色
393
+ */
97
394
  setEmissiveFactor(val: Vector3 | spec.vec3): void;
98
395
  }
396
+ /**
397
+ * 材质类型,包括无光照材质和 PBR 材质
398
+ */
99
399
  export type PMaterial = PMaterialUnlit | PMaterialPBR;
400
+ /**
401
+ * 创建插件材质对象
402
+ * @param options - 材质参数
403
+ * @returns 材质对象
404
+ */
100
405
  export declare function createPluginMaterial(options: ModelMaterialOptions): PMaterial;
101
406
  export declare function createInternalMaterial(options: {}): {};
@@ -1,5 +1,7 @@
1
1
  import { math } from '@galacean/effects';
2
2
  export declare const Vector2: typeof math.Vector2, Vector3: typeof math.Vector3, Vector4: typeof math.Vector4, Matrix3: typeof math.Matrix3, Matrix4: typeof math.Matrix4, Euler: typeof math.Euler, EulerOrder: typeof math.EulerOrder, Quaternion: typeof math.Quaternion, Box3: typeof math.Box3, Sphere: typeof math.Sphere, Ray: typeof math.Ray, DEG2RAD: number;
3
+ export type Ray = math.Ray;
4
+ export type Euler = math.Euler;
3
5
  export type Vector2 = math.Vector2;
4
6
  export type Vector3 = math.Vector3;
5
7
  export type Vector4 = math.Vector4;