1.0 KiB
1.0 KiB
配置示例与事件清单
推荐的配置结构
{
"camera": { "position": [2.5, 1.6, 3.2], "target": [0, 0.8, 0], "fov": 45 },
"environment": { "hdr": "/envs/showroom_2k.hdr", "exposure": 1.1, "rotation": [0, 45, 0] },
"lights": {
"key": { "intensity": 1.5, "color": "#ffffff", "direction": [0.3, -1, 0.25] },
"fill": { "intensity": 0.6, "color": "#dfe8ff" },
"ambient": { "intensity": 0.25 }
},
"hotspots": [
{ "id": "engine", "position": [0.8, 0.6, -0.2], "icon": "info", "label": "发动机舱", "event": "show-engine" },
{ "id": "door", "position": [1.1, 0.9, 0.4], "icon": "action", "label": "开启车门", "event": "toggle-door" }
]
}
事件清单(示例)
- 相机:
camera:changed - 热点:
hotspot:click、hotspot:hover、hotspot:rendered - 模型:
model:loaded、model:replaced、model:destroyed - 材质:
material:applied、material:reset
订阅方式:
sdk.on('hotspot:click', (evt) => console.log(evt))
sdk.off('hotspot:click', handler) // 移除监听