创建一个新的客户端实例。
DIVA 客户端构造选项
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
Optional
options: boolean | AddEventListenerOptionsOptional
options: boolean | AddEventListenerOptionsOptional
options: boolean | AddEventListenerOptions应用指定场景名称的场景。
场景名称
Optional
options: ApplySceneOptions应用场景选项
应用指定场景索引值的场景。
场景索引值
Optional
options: ApplySceneOptions应用场景选项
批量处理多条 rpc 请求。 Note: 任意一个 rpc 请求失败,都将导致批量请求抛出异常。
请求的响应结果列表
rpc 请求列表
获取指定 DIVA 大纲组下的实体列表。获取到的实例都将会根据其具体类型实例化为 相对应的对象实例,如模型(Model)、灯光(Light)、设备(Device)等。
一个包含对象化实例列表的期约(Promise)
DIVA 大纲组的全路径
获取指定名称的实例列表。获取到的实例都将会根据其具体类型实例化为相对应的 对象实例,如模型(Model)、灯光(Light)、设备(Device)等。
一个包含对象化实例列表的期约(Promise)
DIVA 大纲中实体的名称
获取指定 id 的实体。获取到的实例会根据其具体类型实例化为相对应的对象实例, 如模型(Model)、灯光(Light)、设备(Device)等。
一个包含对象化实例的期约(Promise)
实体唯一标识符
获取指定 DIVA 大纲组下的实体组。获取到的实例都将会根据其具体类型实例化为 相对应的对象实例,如模型(Model)、灯光(Light)、设备(Device)等。
一个包含对象化实例组的期约(Promise)
DIVA 大纲组的全路径
经纬度坐标转世界笛卡尔坐标。
世界坐标数组
经纬度坐标或经纬度坐标数组
经纬度坐标转世界笛卡尔坐标。
世界坐标数组
经纬度坐标或经纬度坐标数组
暂停当前正在播放的相机轨。 再次播放该相机轨时,将从当前暂停处继续播放。 如当前没有正在播放的相机轨,调用则不会有任何作用。
播放指定名称的相机轨。 如当前尚有一条相机轨正在播放过程中,便调用播放另一条相机轨时,将会立即开始 播放并停止当前播放中的相机轨。
相机轨名称
Optional
options: PlayCameraTrackOptions相机轨选项
播放指定索引值的相机轨。 如当前尚有一条相机轨正在播放过程中,便调用播放另一条相机轨时,将会立即开始 播放并停止当前播放中的相机轨。
相机轨索引值
Optional
options: PlayCameraTrackOptions相机轨选项
Removes the event listener in target's event listener list with the same type, callback, and options.
Optional
options: boolean | EventListenerOptionsOptional
options: boolean | EventListenerOptionsOptional
options: boolean | EventListenerOptions通过数据通道向服务端发送 rpc 请求,并异步等待响应结果。
请求的响应结果
rpc 请求的方法名
Optional
params: RpcParamsrpc 请求的参数
约束参数
设置镜头参数。
请使用摄像机类 getCamera 提供的方法
并在修改完成时调用更新方法 update 将变更同步更新至后端
const camera = await this.client.getCamera();
camera.position = new Vector(...); // 相机位置
camera.rotation = new Quaternion(...); // 相机旋转
await camera.update() // 更新同步至后端
约束参数
设置罗盘的启用状态。
是否启用
设置当前世界的日期。
日期
将高亮模式重置为预设效果。
自定义设置高亮叠色模式效果。
高亮叠色选项
Optional
border?: { color?: string; width?: number }高亮边缘轮廓。
Optional
color?: string轮廓颜色,hex 字符串。默认值:#80F3FF
Optional
width?: number轮廓宽度。默认值:2
Optional
color?: string高亮叠加颜色,hex 字符串, 支持 alpha 通道。默认值:#FFFFFF00(透明)
设置场景中的移动模式。
移动模式
设置自动旋转。
是否自动旋转
旋转方向,取值 'clockwise' 表示顺时针,'anticlockwise' 表示逆时针,默认顺时针
旋转一周的时长,单位(秒),默认 10 秒
设置服务后端运行渲染的分辨率。
Note: 当设置的分辨率超过 4k(3840*2160) 时,将会按比例缩小至范围内。
设置太阳仿真的启用状态
是否启用
设置当前世界的时间。
时间
设置当前世界的天气。
天气名称
停止当前正在播放的相机轨。 再次播放该相机轨时,将从头开始。 如当前没有正在播放的相机轨,调用则不会有任何作用。
世界笛卡尔坐标转 CIM 地理经纬度坐标。
经纬度坐标数组
DIVA 客户端类,保存与 DIVA 交互所需要的数据,并提供交互方法。