@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.
- package/dist/gesture/index.d.ts +5 -4
- package/dist/gltf/loader-helper.d.ts +1 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8358 -6785
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.mjs +8357 -6784
- package/dist/index.mjs.map +1 -1
- package/dist/loader.mjs +10070 -4913
- package/dist/loader.mjs.map +1 -1
- package/dist/plugin/const.d.ts +3 -0
- package/dist/plugin/index.d.ts +0 -2
- package/dist/plugin/model-item.d.ts +258 -0
- package/dist/plugin/model-plugin.d.ts +91 -18
- package/dist/plugin/model-tree-item.d.ts +113 -6
- package/dist/plugin/model-tree-plugin.d.ts +9 -8
- package/dist/runtime/anim-sampler.d.ts +20 -0
- package/dist/runtime/animation.d.ts +179 -26
- package/dist/runtime/cache.d.ts +75 -0
- package/dist/runtime/camera.d.ts +130 -5
- package/dist/runtime/common.d.ts +143 -4
- package/dist/runtime/light.d.ts +95 -6
- package/dist/runtime/material.d.ts +306 -1
- package/dist/runtime/math.d.ts +2 -0
- package/dist/runtime/mesh.d.ts +242 -32
- package/dist/runtime/object.d.ts +88 -10
- package/dist/runtime/scene.d.ts +156 -27
- package/dist/runtime/shader-libs/standard-shader-source.d.ts +10 -0
- package/dist/runtime/shader-libs/standard-shader.d.ts +16 -0
- package/dist/runtime/shader.d.ts +33 -1
- package/dist/runtime/skybox.d.ts +233 -9
- package/dist/utility/debug-helper.d.ts +14 -0
- package/dist/utility/hit-test-helper.d.ts +39 -3
- package/dist/utility/plugin-helper.d.ts +665 -14
- package/dist/utility/ri-helper.d.ts +67 -0
- package/dist/utility/shader-helper.d.ts +55 -0
- package/dist/utility/ts-helper.d.ts +6 -0
- package/package.json +4 -4
- package/dist/plugin/model-tree-vfx-item.d.ts +0 -15
- package/dist/plugin/model-vfx-item.d.ts +0 -28
- package/dist/runtime/shadow.d.ts +0 -230
package/dist/runtime/scene.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Mesh, Renderer, Texture, Engine, math, CameraOptionsEx } from '@galacean/effects';
|
|
2
2
|
import { spec } from '@galacean/effects';
|
|
3
|
-
import type { ModelItem, ModelVFXItem } from '../plugin/model-vfx-item';
|
|
4
3
|
import { PMesh } from './mesh';
|
|
5
4
|
import type { PCamera } from './camera';
|
|
6
5
|
import { PCameraManager } from './camera';
|
|
@@ -8,57 +7,160 @@ import { PLight, PLightManager } from './light';
|
|
|
8
7
|
import { Vector3, Matrix4, Box3 } from './math';
|
|
9
8
|
import { PSkybox } from './skybox';
|
|
10
9
|
import type { CompositionCache } from './cache';
|
|
11
|
-
import { PShadowManager } from './shadow';
|
|
12
10
|
import type { PEntity } from './object';
|
|
13
11
|
import { TwoStatesSet } from '../utility/ts-helper';
|
|
14
12
|
type Box3 = math.Box3;
|
|
15
13
|
type Vector2 = math.Vector2;
|
|
14
|
+
/**
|
|
15
|
+
* 场景参数接口,初始化场景对象时使用
|
|
16
|
+
*/
|
|
16
17
|
export interface PSceneOptions {
|
|
18
|
+
/**
|
|
19
|
+
* 合成名称
|
|
20
|
+
*/
|
|
17
21
|
componentName: string;
|
|
22
|
+
/**
|
|
23
|
+
* 渲染器
|
|
24
|
+
*/
|
|
18
25
|
renderer: Renderer;
|
|
26
|
+
/**
|
|
27
|
+
* 场景缓存
|
|
28
|
+
*/
|
|
19
29
|
sceneCache: CompositionCache;
|
|
30
|
+
/**
|
|
31
|
+
* 是否只渲染线框
|
|
32
|
+
*/
|
|
20
33
|
wireframeOnly?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 运行时环境
|
|
36
|
+
*/
|
|
21
37
|
runtimeEnv?: string;
|
|
38
|
+
/**
|
|
39
|
+
* 兼容模式
|
|
40
|
+
*/
|
|
22
41
|
compatibleMode?: string;
|
|
42
|
+
/**
|
|
43
|
+
* 是否可视化包围盒
|
|
44
|
+
*/
|
|
23
45
|
visBoundingBox?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* 是否动态排序
|
|
48
|
+
*/
|
|
24
49
|
enableDynamicSort?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* 3D 渲染模式
|
|
52
|
+
*/
|
|
25
53
|
renderMode3D?: spec.RenderMode3D;
|
|
54
|
+
/**
|
|
55
|
+
* 3D 渲染模式中棋盘格大小
|
|
56
|
+
*/
|
|
26
57
|
renderMode3DUVGridSize?: number;
|
|
58
|
+
/**
|
|
59
|
+
* 是否渲染天空盒
|
|
60
|
+
*/
|
|
27
61
|
renderSkybox: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* 灯光元素数目
|
|
64
|
+
*/
|
|
28
65
|
lightItemCount: number;
|
|
29
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* 场景状态接口,每次场景管理器 Tick 时都会生成
|
|
69
|
+
*/
|
|
30
70
|
export interface PSceneStates {
|
|
71
|
+
/**
|
|
72
|
+
* 时间间隔
|
|
73
|
+
*/
|
|
31
74
|
deltaSeconds: number;
|
|
75
|
+
/**
|
|
76
|
+
* 相机对象
|
|
77
|
+
*/
|
|
32
78
|
camera: PCamera;
|
|
79
|
+
/**
|
|
80
|
+
* 相机位置
|
|
81
|
+
*/
|
|
33
82
|
cameraPosition: Vector3;
|
|
83
|
+
/**
|
|
84
|
+
* 相机矩阵
|
|
85
|
+
*/
|
|
34
86
|
viewMatrix: Matrix4;
|
|
87
|
+
/**
|
|
88
|
+
* 投影矩阵
|
|
89
|
+
*/
|
|
35
90
|
projectionMatrix: Matrix4;
|
|
91
|
+
/**
|
|
92
|
+
* 相机投影矩阵
|
|
93
|
+
*/
|
|
36
94
|
viewProjectionMatrix: Matrix4;
|
|
95
|
+
/**
|
|
96
|
+
* 画布大小
|
|
97
|
+
*/
|
|
37
98
|
winSize: Vector2;
|
|
99
|
+
/**
|
|
100
|
+
* 场景半径
|
|
101
|
+
*/
|
|
38
102
|
sceneRadius: number;
|
|
39
103
|
shadowMapSizeInv?: Vector2;
|
|
40
104
|
lightViewMatrix?: Matrix4;
|
|
41
105
|
lightProjectionMatrix?: Matrix4;
|
|
42
106
|
lightViewProjectionMatrix?: Matrix4;
|
|
107
|
+
/**
|
|
108
|
+
* 灯光对象列表
|
|
109
|
+
*/
|
|
43
110
|
lightList: PLight[];
|
|
111
|
+
/**
|
|
112
|
+
* 最大灯光数目
|
|
113
|
+
*/
|
|
44
114
|
maxLightCount: number;
|
|
115
|
+
/**
|
|
116
|
+
* 天空盒对象
|
|
117
|
+
*/
|
|
45
118
|
skybox?: PSkybox;
|
|
46
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* 场景管理类,如果存在 Model 插件中的元素才会创建
|
|
122
|
+
*/
|
|
47
123
|
export declare class PSceneManager {
|
|
124
|
+
/**
|
|
125
|
+
* 合成名称
|
|
126
|
+
*/
|
|
48
127
|
compName: string;
|
|
128
|
+
/**
|
|
129
|
+
* 实体列表
|
|
130
|
+
*/
|
|
49
131
|
itemList: PEntity[];
|
|
132
|
+
/**
|
|
133
|
+
* Mesh 列表
|
|
134
|
+
*/
|
|
50
135
|
meshList: PMesh[];
|
|
136
|
+
/**
|
|
137
|
+
* 灯光管理器
|
|
138
|
+
*/
|
|
51
139
|
lightManager: PLightManager;
|
|
140
|
+
/**
|
|
141
|
+
* 相机管理器
|
|
142
|
+
*/
|
|
52
143
|
cameraManager: PCameraManager;
|
|
53
|
-
shadowManager: PShadowManager;
|
|
54
144
|
/**
|
|
55
145
|
* 是否动态排序 Mesh 渲染优先级
|
|
56
146
|
* 默认 false,需要和 Tiny 对齐时为 true
|
|
57
147
|
*/
|
|
58
148
|
enableDynamicSort: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* IBL 渲染时的 BRDF 查询纹理
|
|
151
|
+
*/
|
|
59
152
|
brdfLUT?: Texture;
|
|
153
|
+
/**
|
|
154
|
+
* 天空盒
|
|
155
|
+
*/
|
|
60
156
|
skybox?: PSkybox;
|
|
157
|
+
/**
|
|
158
|
+
* Tick 次数
|
|
159
|
+
*/
|
|
61
160
|
tickCount: number;
|
|
161
|
+
/**
|
|
162
|
+
* 最近 Tick 时间
|
|
163
|
+
*/
|
|
62
164
|
lastTickSecond: number;
|
|
63
165
|
/**
|
|
64
166
|
* 当前场景包围盒缓存,在阴影渲染中使用
|
|
@@ -69,65 +171,92 @@ export declare class PSceneManager {
|
|
|
69
171
|
*/
|
|
70
172
|
renderedMeshSet: TwoStatesSet<Mesh>;
|
|
71
173
|
/**
|
|
72
|
-
*
|
|
174
|
+
* 最多灯光数目
|
|
175
|
+
*/
|
|
176
|
+
maxLightCount: number;
|
|
177
|
+
/**
|
|
178
|
+
* 场景状态
|
|
73
179
|
*/
|
|
74
|
-
|
|
180
|
+
sceneStates: PSceneStates;
|
|
75
181
|
private renderer?;
|
|
76
182
|
private sceneCache?;
|
|
77
183
|
private parentId2Mesh;
|
|
78
|
-
private maxLightCount;
|
|
79
184
|
private renderSkybox;
|
|
80
185
|
private engine;
|
|
81
186
|
constructor(engine: Engine);
|
|
187
|
+
/**
|
|
188
|
+
* 初始化场景管理器,设置全局状态
|
|
189
|
+
* @param opts - 场景参数
|
|
190
|
+
*/
|
|
82
191
|
initial(opts: PSceneOptions): void;
|
|
83
192
|
private initGlobalState;
|
|
84
193
|
private clean;
|
|
194
|
+
/**
|
|
195
|
+
* 销毁,需要销毁各种管理器和创建的 WebGL 资源
|
|
196
|
+
*/
|
|
85
197
|
dispose(): void;
|
|
86
|
-
addItem(item: ModelVFXItem): void;
|
|
87
|
-
removeItem(item: ModelVFXItem): void;
|
|
88
|
-
updateDefaultCamera(camera: CameraOptionsEx): void;
|
|
89
|
-
buildItem(item: ModelItem): void;
|
|
90
198
|
/**
|
|
91
|
-
*
|
|
199
|
+
* 添加插件元素到场景中
|
|
200
|
+
* @param item - 插件元素
|
|
92
201
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
202
|
+
addItem(item: PMesh | PCamera | PLight | PSkybox): void;
|
|
203
|
+
/**
|
|
204
|
+
* 从场景中删除插件元素
|
|
205
|
+
* @param item - 插件元素
|
|
206
|
+
*/
|
|
207
|
+
removeItem(item: PMesh | PCamera | PLight | PSkybox): void;
|
|
208
|
+
/**
|
|
209
|
+
* 更新默认相机状态,根据传入的相机参数
|
|
210
|
+
* @param camera - 相机参数
|
|
211
|
+
*/
|
|
212
|
+
updateDefaultCamera(camera: CameraOptionsEx): void;
|
|
95
213
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* @param frame - RI 帧对象
|
|
214
|
+
* 更新插件场景,需要更新内部的相关的插件对象,特别是 Mesh 对象的骨骼动画
|
|
215
|
+
* 并将需要渲染的对象添加到渲染对象集合中
|
|
216
|
+
* @param deltaTime - 更新间隔
|
|
101
217
|
*/
|
|
102
|
-
|
|
218
|
+
tick(deltaTime: number): void;
|
|
103
219
|
/**
|
|
104
220
|
* 动态调整 Mesh 渲染优先级
|
|
105
221
|
* 主要是为了和 Tiny 渲染对齐,正常渲染不进行调整
|
|
106
|
-
*
|
|
107
222
|
* @param states - 场景中的状态数据
|
|
108
223
|
*/
|
|
109
224
|
dynamicSortMeshes(states: PSceneStates): void;
|
|
110
225
|
/**
|
|
111
226
|
* 查询场景中的 Mesh
|
|
112
227
|
* 通过 parentId 查询 Mesh 对象,可能找不到 Mesh 对象
|
|
113
|
-
*
|
|
114
228
|
* @param parentId - Item 中定义的 parentId
|
|
115
229
|
* @returns 查询到的 PMesh,或者是没找到。如果 Mesh 不可见,也是没找到。
|
|
116
230
|
*/
|
|
117
231
|
queryMesh(parentId: string): PMesh | undefined;
|
|
118
232
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* @
|
|
233
|
+
* 获取场景的包围盒
|
|
234
|
+
* @param box - 包围盒
|
|
235
|
+
* @returns 场景的包围盒
|
|
122
236
|
*/
|
|
123
|
-
removeAllMeshesFromDefaultPass(renderFrame: RenderFrame): void;
|
|
124
237
|
getSceneAABB(box?: Box3): Box3;
|
|
125
238
|
printDebugInfo(): void;
|
|
239
|
+
/**
|
|
240
|
+
* 获取渲染器
|
|
241
|
+
* @returns
|
|
242
|
+
*/
|
|
126
243
|
getRenderer(): Renderer;
|
|
244
|
+
/**
|
|
245
|
+
* 获取场景中缓存
|
|
246
|
+
* @returns
|
|
247
|
+
*/
|
|
127
248
|
getSceneCache(): CompositionCache;
|
|
249
|
+
/**
|
|
250
|
+
* 获取激活的相机
|
|
251
|
+
*/
|
|
128
252
|
get activeCamera(): PCamera;
|
|
253
|
+
/**
|
|
254
|
+
* 获取灯光数目
|
|
255
|
+
*/
|
|
129
256
|
get lightCount(): number;
|
|
257
|
+
/**
|
|
258
|
+
* 获取着色器灯光数目,最小是 10
|
|
259
|
+
*/
|
|
130
260
|
get shaderLightCount(): number;
|
|
131
|
-
get enableShadowPass(): boolean;
|
|
132
261
|
}
|
|
133
262
|
export {};
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GLSL 着色器代码编译预处理
|
|
3
|
+
*/
|
|
1
4
|
export declare namespace StandardShaderSource {
|
|
5
|
+
/**
|
|
6
|
+
* GLSL 代码预处理和生成最终代码
|
|
7
|
+
* @param source - GLSL 代码
|
|
8
|
+
* @param features - 宏定义
|
|
9
|
+
* @param isWebGL2 - 是否 WebGL2
|
|
10
|
+
* @returns 最终代码
|
|
11
|
+
*/
|
|
2
12
|
function build(source: string, features: string[], isWebGL2: boolean): string;
|
|
3
13
|
}
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import type { PShaderContext } from '../shader';
|
|
2
|
+
/**
|
|
3
|
+
* 着色器代码生成类
|
|
4
|
+
*/
|
|
2
5
|
export declare class StandardShader {
|
|
6
|
+
/**
|
|
7
|
+
* WebGL 环境
|
|
8
|
+
*/
|
|
3
9
|
static environment: string;
|
|
10
|
+
/**
|
|
11
|
+
* 获取顶点着色器代码
|
|
12
|
+
* @param context - 着色器上下文
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
4
15
|
static getVertexShaderCode(context: PShaderContext): string;
|
|
16
|
+
/**
|
|
17
|
+
* 获取片段着色器代码
|
|
18
|
+
* @param context - 着色器上下文
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
5
21
|
static getFragmentShaderCode(context: PShaderContext): string;
|
|
6
22
|
}
|
package/dist/runtime/shader.d.ts
CHANGED
|
@@ -1,18 +1,50 @@
|
|
|
1
1
|
import type { PMaterialBase } from './material';
|
|
2
|
+
/**
|
|
3
|
+
* 着色器上下文
|
|
4
|
+
*/
|
|
2
5
|
export interface PShaderContext {
|
|
6
|
+
/**
|
|
7
|
+
* 材质
|
|
8
|
+
*/
|
|
3
9
|
material: PMaterialBase;
|
|
10
|
+
/**
|
|
11
|
+
* 是否 WebGL2
|
|
12
|
+
*/
|
|
4
13
|
isWebGL2: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 特性列表
|
|
16
|
+
*/
|
|
5
17
|
featureList: string[];
|
|
6
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* 着色器返回的代码结果
|
|
21
|
+
*/
|
|
7
22
|
export interface PShaderResults {
|
|
23
|
+
/**
|
|
24
|
+
* 顶点着色器代码
|
|
25
|
+
*/
|
|
8
26
|
vertexShaderCode: string;
|
|
27
|
+
/**
|
|
28
|
+
* 片段着色器代码
|
|
29
|
+
*/
|
|
9
30
|
fragmentShaderCode: string;
|
|
10
31
|
}
|
|
11
|
-
|
|
32
|
+
/**
|
|
33
|
+
* 着色器管理类
|
|
34
|
+
*/
|
|
12
35
|
export declare class PShaderManager {
|
|
13
36
|
private funcMap;
|
|
14
37
|
private static _instance;
|
|
38
|
+
/**
|
|
39
|
+
* 获取着色器单例对象
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
15
42
|
static getInstance(): PShaderManager;
|
|
16
43
|
private constructor();
|
|
44
|
+
/**
|
|
45
|
+
* 生成着色器代码
|
|
46
|
+
* @param context - 着色器上下文
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
17
49
|
genShaderCode(context: PShaderContext): PShaderResults;
|
|
18
50
|
}
|
package/dist/runtime/skybox.d.ts
CHANGED
|
@@ -1,86 +1,310 @@
|
|
|
1
|
-
import type { Mesh, Material, TextureSourceOptions, Engine } from '@galacean/effects';
|
|
1
|
+
import type { Mesh, Material, TextureSourceOptions, Engine, Renderer } from '@galacean/effects';
|
|
2
2
|
import { Texture } from '@galacean/effects';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ModelSkyboxOptions } from '../index';
|
|
4
4
|
import { PEntity } from './object';
|
|
5
5
|
import { PMaterialBase } from './material';
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
|
|
6
|
+
import type { PSceneManager } from './scene';
|
|
7
|
+
import type { ModelSkyboxComponent } from '../plugin/model-item';
|
|
8
|
+
/**
|
|
9
|
+
* 天空盒类,支持天空盒的渲染和 IBL 光照效果
|
|
10
|
+
*/
|
|
9
11
|
export declare class PSkybox extends PEntity {
|
|
12
|
+
/**
|
|
13
|
+
* 所属的天空盒组件
|
|
14
|
+
*/
|
|
15
|
+
owner?: ModelSkyboxComponent;
|
|
16
|
+
/**
|
|
17
|
+
* 是否渲染
|
|
18
|
+
*/
|
|
10
19
|
renderable: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* 强度
|
|
22
|
+
*/
|
|
11
23
|
intensity: number;
|
|
24
|
+
/**
|
|
25
|
+
* 反射强度
|
|
26
|
+
*/
|
|
12
27
|
reflectionsIntensity: number;
|
|
28
|
+
/**
|
|
29
|
+
* 辐射照度系数
|
|
30
|
+
*/
|
|
13
31
|
irradianceCoeffs?: number[][];
|
|
32
|
+
/**
|
|
33
|
+
* 漫反射贴图
|
|
34
|
+
*/
|
|
14
35
|
diffuseImage?: Texture;
|
|
36
|
+
/**
|
|
37
|
+
* 高光贴图
|
|
38
|
+
*/
|
|
15
39
|
specularImage: Texture;
|
|
40
|
+
/**
|
|
41
|
+
* 高光贴图大小
|
|
42
|
+
*/
|
|
16
43
|
specularImageSize: number;
|
|
44
|
+
/**
|
|
45
|
+
* 高光贴图 Mip 层数目
|
|
46
|
+
*/
|
|
17
47
|
specularMipCount: number;
|
|
48
|
+
/**
|
|
49
|
+
* BRDF 查询纹理
|
|
50
|
+
*/
|
|
18
51
|
brdfLUT?: Texture;
|
|
52
|
+
/**
|
|
53
|
+
* 优先级
|
|
54
|
+
*/
|
|
19
55
|
priority: number;
|
|
56
|
+
/**
|
|
57
|
+
* 天空盒 Mesh
|
|
58
|
+
*/
|
|
20
59
|
skyboxMesh?: Mesh;
|
|
60
|
+
/**
|
|
61
|
+
* 天空盒材质
|
|
62
|
+
*/
|
|
21
63
|
skyboxMaterial?: PMaterialSkyboxFilter;
|
|
64
|
+
/**
|
|
65
|
+
* 是否构建过
|
|
66
|
+
*/
|
|
22
67
|
isBuilt: boolean;
|
|
23
|
-
|
|
68
|
+
/**
|
|
69
|
+
* 构造函数
|
|
70
|
+
* @param name - 名称
|
|
71
|
+
* @param options - 天空盒参数
|
|
72
|
+
* @param owner - 所属天空盒组件元素
|
|
73
|
+
*/
|
|
74
|
+
constructor(name: string, options: ModelSkyboxOptions, owner?: ModelSkyboxComponent);
|
|
75
|
+
/**
|
|
76
|
+
* 设置 BRDF 查询纹理
|
|
77
|
+
* @param brdfLUT - 纹理
|
|
78
|
+
*/
|
|
24
79
|
setup(brdfLUT?: Texture): void;
|
|
25
|
-
|
|
80
|
+
/**
|
|
81
|
+
* 构建天空盒,创建天空盒材质,从场景缓存中创建天空盒 Mesh
|
|
82
|
+
* @param sceneCache - 场景缓存
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
build(scene: PSceneManager): void;
|
|
86
|
+
/**
|
|
87
|
+
* 渲染天空盒
|
|
88
|
+
* @param scene - 场景
|
|
89
|
+
* @param renderer - 渲染器
|
|
90
|
+
*/
|
|
91
|
+
render(scene: PSceneManager, renderer: Renderer): void;
|
|
92
|
+
/**
|
|
93
|
+
* 销毁
|
|
94
|
+
*/
|
|
26
95
|
dispose(): void;
|
|
27
|
-
|
|
28
|
-
|
|
96
|
+
private updateMaterial;
|
|
97
|
+
/**
|
|
98
|
+
* 是否可用,根据内部的强度、辐射照度系数、漫反射贴图和高光贴图状态
|
|
99
|
+
*/
|
|
29
100
|
get available(): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* 当前强度,如果不可见返回 0
|
|
103
|
+
*/
|
|
30
104
|
get currentIntensity(): number;
|
|
105
|
+
/**
|
|
106
|
+
* 当前反射强度,如果不可见返回 0
|
|
107
|
+
*/
|
|
31
108
|
get currentReflectionsIntensity(): number;
|
|
109
|
+
/**
|
|
110
|
+
* 是否有漫反射贴图
|
|
111
|
+
*/
|
|
32
112
|
get hasDiffuseImage(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* 是否有辐射照度系数
|
|
115
|
+
*/
|
|
33
116
|
get hasIrradianceCoeffs(): boolean;
|
|
34
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* 天空盒材质类
|
|
120
|
+
*/
|
|
35
121
|
export declare class PMaterialSkyboxFilter extends PMaterialBase {
|
|
122
|
+
/**
|
|
123
|
+
* 强度
|
|
124
|
+
*/
|
|
36
125
|
intensity: number;
|
|
126
|
+
/**
|
|
127
|
+
* 反射强度
|
|
128
|
+
*/
|
|
37
129
|
reflectionsIntensity: number;
|
|
130
|
+
/**
|
|
131
|
+
* BRDF 查询纹理
|
|
132
|
+
*/
|
|
38
133
|
brdfLUT?: Texture;
|
|
134
|
+
/**
|
|
135
|
+
* 辐射照度系数
|
|
136
|
+
*/
|
|
39
137
|
irradianceCoeffs?: number[][];
|
|
138
|
+
/**
|
|
139
|
+
* 漫反射贴图
|
|
140
|
+
*/
|
|
40
141
|
diffuseImage?: Texture;
|
|
142
|
+
/**
|
|
143
|
+
* 高光贴图
|
|
144
|
+
*/
|
|
41
145
|
specularImage: Texture;
|
|
146
|
+
/**
|
|
147
|
+
* 高光贴图 Mip 数目
|
|
148
|
+
*/
|
|
42
149
|
specularMipCount: number;
|
|
150
|
+
/**
|
|
151
|
+
* 创建天空盒材质,从天空盒对象
|
|
152
|
+
* @param skybox - 天空盒对象
|
|
153
|
+
*/
|
|
43
154
|
create(skybox: PSkybox): void;
|
|
155
|
+
/**
|
|
156
|
+
* 销毁,需要解除资源引用
|
|
157
|
+
*/
|
|
44
158
|
dispose(): void;
|
|
159
|
+
/**
|
|
160
|
+
* 获取着色器特性列表
|
|
161
|
+
* @returns
|
|
162
|
+
*/
|
|
45
163
|
getShaderFeatures(): string[];
|
|
164
|
+
/**
|
|
165
|
+
* 更新着色器 Uniform 数据
|
|
166
|
+
* @param material - 对应的 Core 层材质
|
|
167
|
+
*/
|
|
46
168
|
updateUniforms(material: Material): void;
|
|
169
|
+
/**
|
|
170
|
+
* 设置对应的材质状态
|
|
171
|
+
* @param material - 对应的 Core 层材质
|
|
172
|
+
*/
|
|
47
173
|
setMaterialStates(material: Material): void;
|
|
48
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* 图像缓冲区数据接口
|
|
177
|
+
*/
|
|
49
178
|
export interface PImageBufferData {
|
|
179
|
+
/**
|
|
180
|
+
* 类型,总是 buffer
|
|
181
|
+
*/
|
|
50
182
|
type: 'buffer';
|
|
183
|
+
/**
|
|
184
|
+
* 数组
|
|
185
|
+
*/
|
|
51
186
|
data: Uint8Array;
|
|
187
|
+
/**
|
|
188
|
+
* MIME 类型
|
|
189
|
+
*/
|
|
52
190
|
mimeType: string;
|
|
53
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* 图像数据类型,字符串(URL)或者图像缓冲区数据
|
|
194
|
+
*/
|
|
54
195
|
export type PImageData = string | PImageBufferData;
|
|
196
|
+
/**
|
|
197
|
+
* 天空盒基础参数接口
|
|
198
|
+
*/
|
|
55
199
|
export interface PSkyboxBaseParams {
|
|
200
|
+
/**
|
|
201
|
+
* 是否渲染
|
|
202
|
+
*/
|
|
56
203
|
renderable: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* 强度
|
|
206
|
+
*/
|
|
57
207
|
intensity: number;
|
|
208
|
+
/**
|
|
209
|
+
* 反射强度
|
|
210
|
+
*/
|
|
58
211
|
reflectionsIntensity: number;
|
|
212
|
+
/**
|
|
213
|
+
* 辐射照度系数
|
|
214
|
+
*/
|
|
59
215
|
irradianceCoeffs?: number[][];
|
|
216
|
+
/**
|
|
217
|
+
* 高光贴图 Mip 层数
|
|
218
|
+
*/
|
|
60
219
|
specularMipCount: number;
|
|
220
|
+
/**
|
|
221
|
+
* 高光贴图大小
|
|
222
|
+
*/
|
|
61
223
|
specularImageSize: number;
|
|
62
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* 天空盒 URL 参数接口
|
|
227
|
+
*/
|
|
63
228
|
export interface PSkyboxURLParams extends PSkyboxBaseParams {
|
|
229
|
+
/**
|
|
230
|
+
* 类型,总是 url
|
|
231
|
+
*/
|
|
64
232
|
type: 'url';
|
|
233
|
+
/**
|
|
234
|
+
* 漫反射贴图 URL 列表
|
|
235
|
+
*/
|
|
65
236
|
diffuseImage?: string[];
|
|
237
|
+
/**
|
|
238
|
+
* 高光贴图 URL 二级列表
|
|
239
|
+
*/
|
|
66
240
|
specularImage: string[][];
|
|
67
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* 天空盒缓冲区参数接口
|
|
244
|
+
*/
|
|
68
245
|
export interface PSkyboxBufferParams extends PSkyboxBaseParams {
|
|
246
|
+
/**
|
|
247
|
+
* 类型,总是 buffer
|
|
248
|
+
*/
|
|
69
249
|
type: 'buffer';
|
|
250
|
+
/**
|
|
251
|
+
* 漫反射贴图列表
|
|
252
|
+
*/
|
|
70
253
|
diffuseImage?: PImageBufferData[];
|
|
254
|
+
/**
|
|
255
|
+
* 高光贴图二级列表
|
|
256
|
+
*/
|
|
71
257
|
specularImage: PImageBufferData[][];
|
|
72
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* 天空盒参数类型
|
|
261
|
+
*/
|
|
73
262
|
export type PSkyboxParams = PSkyboxURLParams | PSkyboxBufferParams;
|
|
74
263
|
export declare enum PSkyboxType {
|
|
75
264
|
NFT = 0,
|
|
76
265
|
FARM = 1
|
|
77
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* 天空盒创建类
|
|
269
|
+
*/
|
|
78
270
|
export declare class PSkyboxCreator {
|
|
271
|
+
/**
|
|
272
|
+
* 获取 BRDF 查询纹理选项
|
|
273
|
+
* @returns 纹理源选项
|
|
274
|
+
*/
|
|
79
275
|
static getBrdfLutTextureOptions(): Promise<TextureSourceOptions>;
|
|
276
|
+
/**
|
|
277
|
+
* 创建 BRDF 查询纹理
|
|
278
|
+
* @param engine - 引擎
|
|
279
|
+
* @returns 纹理
|
|
280
|
+
*/
|
|
80
281
|
static createBrdfLutTexture(engine: Engine): Promise<Texture>;
|
|
282
|
+
/**
|
|
283
|
+
* 创建天空盒选项
|
|
284
|
+
* @param engine - 引擎
|
|
285
|
+
* @param params - 天空盒参数
|
|
286
|
+
* @returns 天空盒选项
|
|
287
|
+
*/
|
|
81
288
|
static createSkyboxOptions(engine: Engine, params: PSkyboxParams): Promise<ModelSkyboxOptions>;
|
|
289
|
+
/**
|
|
290
|
+
* 创建高光 Cube Map 纹理
|
|
291
|
+
* @param engine - 引擎
|
|
292
|
+
* @param params - 天空盒参数
|
|
293
|
+
* @returns 纹理
|
|
294
|
+
*/
|
|
82
295
|
static createSpecularCubeMap(engine: Engine, params: PSkyboxParams): Promise<Texture>;
|
|
296
|
+
/**
|
|
297
|
+
* 创建漫反射纹理
|
|
298
|
+
* @param engine - 引擎
|
|
299
|
+
* @param params - 天空盒参数
|
|
300
|
+
* @returns 纹理或未定义
|
|
301
|
+
*/
|
|
83
302
|
static createDiffuseCubeMap(engine: Engine, params: PSkyboxParams): Promise<Texture | undefined>;
|
|
303
|
+
/**
|
|
304
|
+
* 创建天空盒参数
|
|
305
|
+
* @param skyboxType - 天空盒类型
|
|
306
|
+
* @returns 天空盒参数
|
|
307
|
+
*/
|
|
84
308
|
static getSkyboxParams(skyboxType?: PSkyboxType): PSkyboxURLParams;
|
|
85
309
|
private checkCubeMapImage;
|
|
86
310
|
private static getIrradianceCoeffs;
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import type { Player } from '@galacean/effects';
|
|
2
2
|
import type { PMesh } from '../runtime/mesh';
|
|
3
3
|
type WebGLContext = WebGL2RenderingContext | WebGLRenderingContext;
|
|
4
|
+
/**
|
|
5
|
+
* Hook WebGL 相关的 API 调用
|
|
6
|
+
* @param ctx - WebGL 上下文
|
|
7
|
+
*/
|
|
4
8
|
export declare function HookOGLFunc(ctx: WebGLContext): void;
|
|
9
|
+
/**
|
|
10
|
+
* 获取播放器关联的 GPU 信息
|
|
11
|
+
* @param player - 播放器
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
5
14
|
export declare function getRendererGPUInfo(player: Player): string;
|
|
15
|
+
/**
|
|
16
|
+
* 获取播放器中 PMesh 对象列表
|
|
17
|
+
* @param player - 播放器
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
6
20
|
export declare function getPMeshList(player: Player): PMesh[];
|
|
7
21
|
export {};
|