English
Home > PCB_RayTracerEngine > importPackage
PCB_RayTracerEngine.importPackage() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
加载光追资源包
Signature
typescript
function importPackage(file: Blob): Promise<void>;1
Parameters
Parameter | Type | Description |
|---|---|---|
file | Blob | 资源包 ZIP 数据 |
Returns
Promise<void>
Remarks
在光追渲染运行期间加载资源包,包内的材质表、纹理、背景与场景模型立即生效,无需重新初始化光追渲染
资源包需由 exportPackage 导出,或符合其目录结构与材质表格式 ADD since EDA v4.1.103
Example
javascript
// 1. 从远端获取资源包(本接口需启用扩展的外部交互权限)
const response = await eda.sys_ClientUrl.request('https://example.com/raytracer-scene.zip', 'GET');
const blob = await response.blob();
// 2. 加载资源包,材质表、纹理、背景与场景模型立即生效
await eda.pcb_RayTracerEngine.importPackage(blob);
console.log('资源包已加载:', blob.size);1
2
3
4
5
6
7
2
3
4
5
6
7