UNPKG

cve-connector

Version:
167 lines (148 loc) 5.82 kB
import type { UIDescriptor } from '../utils/matchmaker' /** * 漫游路径点位 * - Location: 位置坐标(UE位置) * - Rotation: 视角方向(UE方向) */ export interface RoamingPosition { /** 位置坐标(UE位置) */ Location: [x: number, y: number, z: number] /** 视角方向(UE方向) */ Rotation: [roll: number, pitch: number, yaw: number] } /** * 漫游路径 * - Delays: 各段路径延迟时间(s),长度为 n-1 * - Durations: 各段路径飞行时间(s),长度为 n-1 * - Positions: 漫游路径点位集,长度为 n */ export interface RoamingPath { /** 各段路径延迟时间(s) */ Delays: number[] /** 各段路径飞行时间(s) */ Durations: number[] /** 漫游路径点位集 */ Positions: RoamingPosition[] } export type ViewCommand = | 'ChangeViewMode' | 'DeleteWalkthroughPath' | 'FlyTo' | 'FlyToBookmark' | 'GetView' | 'MakeWalkthroughPath' | 'PlayWalkthroughPath' | 'ReplayWalkthroughPath' | 'ResetView' | 'SeekWalkthroughPath' | 'StopWalkthroughPath' /** 视角控制 */ export interface ViewController { /** 新增漫游路径,回调中包含路径 ID */ addPath: (path: RoamingPath) => Promise<UIDescriptor> /** * 改变视角模式 * - SpringArm: 摇臂镜头视角,基于中心点的操作模式 * 1. WASDEQE 移动中心点 * 2. 鼠标左键基于中心的点旋转镜头 * 3. 滚轮键基于中心的点拉近\拉远距离 * 4. 鼠标右键基于所点击的点拖动中心点进行平移 * - GIS: 传统 GIS 操作模式 * 1. 鼠标右键基于当前镜头旋转 * 2. 鼠标左键基于所点击的点拖动镜头平移 * 3. 鼠标中键基于所点击的点旋转当前镜头 * 4. 鼠标滚轮基于鼠标位置拉近\拉远距离 * 5. WASDEQE 移动镜头位置 * - Free: 自由视角 * 1. 鼠标右/左键基于当前镜头旋转 * 2. 鼠标滚轮向当前镜头前方/后方稍微位移 * 3. WASDEQE 移动镜头位置 * 4. 长摁鼠标右+鼠标滚轮,增加/减少镜头移动的速率 * - Editor: 编辑器模式 * 1. 鼠标右/左键基于当前镜头旋转 * 2. 鼠标滚轮向当前镜头前方/后方稍微位移 * 3. WASDEQE 移动镜头位置 * 4. 长摁鼠标右+鼠标滚轮,增加/减少镜头移动的速率 */ changeViewMode: (mode: ViewMode) => Promise<UIDescriptor> /** 通过 ID 删除漫游路径 */ deletePath: (id: string) => Promise<UIDescriptor> /** 飞行到指定的位置 */ flyTo: (settings: ViewSettings, duration: number) => Promise<UIDescriptor> /** 飞行到书签位置 */ flyToBookmark: (bookmark: string, duration: number) => Promise<UIDescriptor> /** 获取当前视角 */ getView: () => Promise<ViewDescriptor> /** 通过 ID 播放路径漫游 */ playPath: (id: string) => Promise<UIDescriptor> /** 通过 ID 重播路径漫游 */ replayPath: (id: string) => Promise<UIDescriptor> /** 视角初始化 */ resetView: (duration: number) => Promise<UIDescriptor> /** 通过 时间 和 ID 切换当前路径漫游的位置 */ seekPath: (id: string, time: number) => Promise<UIDescriptor> /** 通过 ID 停止路径漫游 */ stopPath: (id: string) => Promise<UIDescriptor> } export declare const ViewController: ViewController /** * 视角模式 * - SpringArm: 摇臂镜头视角,基于中心点的操作模式 * 1. WASDEQE 移动中心点 * 2. 鼠标左键基于中心的点旋转镜头 * 3. 滚轮键基于中心的点拉近\拉远距离 * 4. 鼠标右键基于所点击的点拖动中心点进行平移 * - GIS: 传统 GIS 操作模式 * 1. 鼠标右键基于当前镜头旋转 * 2. 鼠标左键基于所点击的点拖动镜头平移 * 3. 鼠标中键基于所点击的点旋转当前镜头 * 4. 鼠标滚轮基于鼠标位置拉近\拉远距离 * 5. WASDEQE 移动镜头位置 * - Free: 自由视角 * 1. 鼠标右/左键基于当前镜头旋转 * 2. 鼠标滚轮向当前镜头前方/后方稍微位移 * 3. WASDEQE 移动镜头位置 * 4. 长摁鼠标右+鼠标滚轮,增加/减少镜头移动的速率 * - Editor: 编辑器模式 * 1. 鼠标右/左键基于当前镜头旋转 * 2. 鼠标滚轮向当前镜头前方/后方稍微位移 * 3. WASDEQE 移动镜头位置 * 4. 长摁鼠标右+鼠标滚轮,增加/减少镜头移动的速率 */ export enum ViewMode { SpringArm = 0, GIS = 1, Free = 2, Editor = 3, } /** * 视角设置参数 * - Distance 距离(m) * - Location 位置坐标(UE位置) * - Rotation 视角方向(UE方向) * - UseCurrentDistance 是否使用当前距离 * - 当 ViewMode 为 SpringArm 模式时,若为 true,则飞行后 ArmLength 保持不变;若为 false,则飞行后 ArmLength 值变为 Distance * - 当 ViewMode 为 GIS 模式时,若为 true,飞行后相机将处于 Location 处,若为 false,飞行后相机将与 Location 保持 Distance 的距离长度 * - UseCurrentRotation 是否使用当前视角方向,若为true,飞行后视角方向保持不变,若为false,飞行后视角方向变到 Rotation 指定的方向 */ export interface ViewSettings { Distance?: number Location: [x: number, y: number, z: number] Rotation?: [roll: number, pitch: number, yaw: number] UseCurrentDistance?: boolean UseCurrentRotation?: boolean } export interface ViewDescriptor extends UIDescriptor { Data: ViewSettings } /** * Get View 原始数据 * - ArmLength 即 Distance * - Location 示例: "X=0.000 Y=-29020.000 Z=31610.000" * - Rotation 示例: "P=-45.000000 Y=0.000000 R=0.000000" */ export interface ViewSource { ArmLength: number Location: string Rotation: string }