# Class Five

如视 VR Web展示器

#### Example

    // 初始化构造函数
    const five = new Five();
    // 将绘制区域添加到页面上
    five.appendTo(document.body);
    // 加载 Work 数据
    five.load({...});

#### Hierarchy (View Summary)

- Subscribe<EventTypes>
  - Five

- Defined in lib/five/application/five.ts:99

##### Index

### Constructors

constructor

### Properties

backgroundAlpha
backgroundColor
camera
currentMode
fiveId
imageOptions
modelScene
needsRender
onlyRenderIfNeeds
pano
paused
plugins
poweredByRealsee
renderer?
scene
state
textureOptions
videoTexture
viewport
xrCustomObjectsScene
Mode

### Accessors

boundingMesh
enableAdaptiveLuminance
enableEDL
enableHQ
enableIOSEDR
enablePostProcessing
helperVisible
ident
internalLightsEnabled
model
models
modelSceneNeedsRender
observers
panoId
panoIndex
renderMode
scissor
work
works
dracoPath
ktx2Path
useNativeImageBitmap
version

### Methods

addExtraElement
addPass
appendTo
changeMode
dispose
emit
exitFullscreen
getCameraLocal
getCurrentState
getDrawingBufferSize
getElement
getLongitudeAndLatitude
getOffset
getPixels
getPose
getSize
hasListener
insertPass
load
moveToPano
off
on
once
pause
play
preloadPano
project2d
ready
refresh
removeExtraElement
removePass
render
requestFullscreen
reset
reset_
setScissor
setState
setViewport
updateCamera
updateCameraWithKeyframes
updateConfiguration
updateTime
waitUntil

## Constructors

### constructor

- new Five(initArgs?: FiveInitArgs): Five

  #### Parameters

  - initArgs: FiveInitArgs = {}

  #### Returns Five

  Overrides Subscribe.constructor

  - Defined in lib/five/application/five.ts:295

## Properties

### backgroundAlpha

backgroundAlpha: number

背景透明度

- Defined in lib/five/application/five.ts:217

### backgroundColor

backgroundColor: Color

背景颜色

- Defined in lib/five/application/five.ts:214

### camera

camera: Camera

内部使用的 `Camera`

- Defined in lib/five/application/five.ts:174

### currentMode

currentMode: Mode

当前展示的模式

- Defined in lib/five/application/five.ts:163

### `Readonly` fiveId

fiveId: string

- Defined in lib/five/application/five.ts:266

### imageOptions

imageOptions: ImageOptions

全景图的配置参数

#### Description

可以动态对配置在 `work` 数据中的全景图片在 runtime 做 url 调整。 平衡加载时间和图片质量

- Defined in lib/five/application/five.ts:225

### modelScene

modelScene: ModelScene

内部模型部分使用的 `THREE.Scene`

- Defined in lib/five/application/five.ts:168

### needsRender

needsRender: boolean

是否需要渲染

#### Description

如果初始化设置了 `onlyRenderIfNeeds: true`, 则会激活按需渲染 可以通过设置 `five.needsRender = true` 来告知，five 会在下一帧渲染画面。

- Defined in lib/five/application/five.ts:203

### onlyRenderIfNeeds

onlyRenderIfNeeds: boolean

是否按需渲染

- Defined in lib/five/application/five.ts:208

### pano

pano: Pano

当前点位序号

- Defined in lib/five/application/five.ts:160

### paused

paused: boolean

自动播放状态是否暂停

#### Description

可以通过 `five.play` `five.pause` 方法播放或暂停

- Defined in lib/five/application/five.ts:157

### plugins

plugins: { [key: string]: any }

插件暴露的方法

- Defined in lib/five/application/five.ts:264

### poweredByRealsee

poweredByRealsee: boolean

是否显示 Powered By Realsee

- Defined in lib/five/application/five.ts:211

### `Optional` renderer

renderer?: WebGLRenderer

当前使用的 THREE.WebGLRenderer。

#### Description

如果初始化时传入了 `renderer` 则直接时该值 否则会通过 `preserveDrawingBuffer` `backgroundColor` `backgroundAlpha` `antialias` 创建一个 `THREE.WebGLRenderer`

- Defined in lib/five/application/five.ts:195

### scene

scene: Scene

非模型部分使用的 `THREE.Scene`

- Defined in lib/five/application/five.ts:166

### state

state: State

当前状态

#### Description

    five 设置了以下状态

    - mode: Mode
    - panoIndex: number
    - longitude: number
    - latitude: number
    - fov: number
    - offset: THREE.Vector3

    可以通过 five.state 和 five.setState 来获取和设置。
    通过 state 设置后，five 会通过合适的动画运动来达到设置的位置。
    来迎合一些通过数据驱动的场景。

- Defined in lib/five/application/five.ts:261

### textureOptions

textureOptions: TextureOptions

模型贴图的配置参数

#### Description

可以动态对配置在 `work` 数据中的模型贴图在 runtime 做 url 调整。 平衡加载时间和图片质量

- Defined in lib/five/application/five.ts:233

### videoTexture

videoTexture: VideoTexture

模型贴图的配置参数

#### Description

可以动态对配置在 `work` 数据中的模型贴图在 runtime 做 url 调整。 平衡加载时间和图片质量

- Defined in lib/five/application/five.ts:241

### viewport

viewport: Viewport

当前设置的 `viewport`

#### Description

可通过初始化，或者 setScissor 方式设置 `viewport` 是将屏幕中的内容渲染到 `renderer` 的指定区域。 页面整体长宽均为 `1`。通过类似 css 的 `left` `bottom` `width` `height` 来确定区域。

#### Example

    viewport: { left: 0.75, bottom: 0, width: 0.25, height: 1 }

- Defined in lib/five/application/five.ts:187

### xrCustomObjectsScene

xrCustomObjectsScene: Scene

供外部放置需要在xr场景下产生遮挡的物体们

- Defined in lib/five/application/five.ts:171

### `Static` Mode

Mode: {
Floorplan: "Floorplan";
Mapview: "Mapview";
Model: "Model";
Panorama: "Panorama";
Topview: "Topview";
VRPanorama: "VRPanorama";
XRPanorama: "XRPanorama";
} = ...

Five 的显示模式，可以通过 `five.changeMode` `five.setState` 来切换

#### Description

    Panorama 全景图游走模式
    Model 模型游走模式
    Floorplan 模型查看模式
    Topview 户型图模式
    VRPanorama VR眼镜模式
    XRPanorama VR硬件模式

- Defined in lib/five/application/five.ts:142

## Accessors

### boundingMesh

- get boundingMesh(): BoundingMesh

  获取 boundingMesh

  #### Returns BoundingMesh

  - Defined in lib/five/application/five.ts:600

### enableAdaptiveLuminance

- get enableAdaptiveLuminance(): boolean

  开启 AdaptiveLuminance

  #### Returns boolean

  - Defined in lib/five/application/five.ts:2871
- set enableAdaptiveLuminance(enable: boolean): void

  #### Parameters

  - enable: boolean

  #### Returns void

  - Defined in lib/five/application/five.ts:2874

### enableEDL

- get enableEDL(): boolean

  开启 edl

  #### Returns boolean

  - Defined in lib/five/application/five.ts:2862
- set enableEDL(enable: boolean): void

  #### Parameters

  - enable: boolean

  #### Returns void

  - Defined in lib/five/application/five.ts:2865

### enableHQ

- get enableHQ(): boolean

  开启 HQ

  #### Returns boolean

  - Defined in lib/five/application/five.ts:2853
- set enableHQ(enable: boolean): void

  #### Parameters

  - enable: boolean

  #### Returns void

  - Defined in lib/five/application/five.ts:2856

### enableIOSEDR

- get enableIOSEDR(): boolean

  #### Returns boolean

  #### Deprecated

  不可用

  - Defined in lib/five/application/five.ts:2883
- set enableIOSEDR(enable: boolean): void

  #### Parameters

  - enable: boolean

  #### Returns void

  - Defined in lib/five/application/five.ts:2886

### enablePostProcessing

- get enablePostProcessing(): boolean

  #### Returns boolean

  #### Deprecated

  不可用

  - Defined in lib/five/application/five.ts:2893
- set enablePostProcessing(enable: boolean): void

  #### Parameters

  - enable: boolean

  #### Returns void

  - Defined in lib/five/application/five.ts:2896

### helperVisible

- get helperVisible(): boolean

  帮助元素显示/隐藏

  #### Returns boolean

  - Defined in lib/five/application/five.ts:607
- set helperVisible(visible: boolean): void

  #### Parameters

  - visible: boolean

  #### Returns void

  - Defined in lib/five/application/five.ts:610

### ident

- get ident(): string

  #### Returns string

  - Defined in lib/five/application/five.ts:509

### internalLightsEnabled

- get internalLightsEnabled(): boolean

  #### Returns boolean

  - Defined in lib/five/application/five.ts:2720
- set internalLightsEnabled(value: boolean): void

  #### Parameters

  - value: boolean

  #### Returns void

  - Defined in lib/five/application/five.ts:2729

### model

- get model(): Model

  #### Returns Model

  - Defined in lib/five/application/five.ts:872

### models

- get models(): Models

  #### Returns Models

  - Defined in lib/five/application/five.ts:868

### modelSceneNeedsRender

- get modelSceneNeedsRender(): boolean

  #### Returns boolean

  #### Deprecated

  use five.modelScene.needsRender instead

  - Defined in lib/five/application/five.ts:2903
- set modelSceneNeedsRender(needsRender: boolean): void

  #### Parameters

  - needsRender: boolean

  #### Returns void

  - Defined in lib/five/application/five.ts:2906

### observers

- get observers(): readonly WorkObserver[]

  #### Returns readonly WorkObserver[]

  - Defined in lib/five/application/five.ts:864

### panoId

- get panoId(): `${string}[${number}]`

  #### Returns `${string}[${number}]`

  - Defined in lib/five/application/five.ts:517

### panoIndex

- get panoIndex(): number

  #### Returns number

  - Defined in lib/five/application/five.ts:513

### renderMode

- get renderMode(): "default" | "ssaa" | "point-cloud-high-quality"

  设置渲染模式

  #### Returns "default" | "ssaa" | "point-cloud-high-quality"

  - Defined in lib/five/application/five.ts:2845
- set renderMode(value: "default" | "ssaa" | "point-cloud-high-quality"): void

  #### Parameters

  - value: "default" | "ssaa" | "point-cloud-high-quality"

  #### Returns void

  - Defined in lib/five/application/five.ts:2848

### scissor

- get scissor(): Viewport

  #### Returns Viewport

  #### Deprecated

  use Viewport instead.

  - Defined in lib/five/application/five.ts:2746

### work

- get work(): Work

  #### Returns Work

  - Defined in lib/five/application/five.ts:860

### works

- get works(): Works

  当前加载的 work 数据

  #### Returns Works

  - Defined in lib/five/application/five.ts:852

### `Static` dracoPath

- get dracoPath(): string

  #### Returns string

  - Defined in lib/five/application/five.ts:106
- set dracoPath(path: string): void

  #### Parameters

  - path: string

  #### Returns void

  - Defined in lib/five/application/five.ts:110

### `Static` ktx2Path

- get ktx2Path(): string

  #### Returns string

  - Defined in lib/five/application/five.ts:114
- set ktx2Path(path: string): void

  #### Parameters

  - path: string

  #### Returns void

  - Defined in lib/five/application/five.ts:118

### `Static` useNativeImageBitmap

- get useNativeImageBitmap(): boolean

  #### Returns boolean

  - Defined in lib/five/application/five.ts:122
- set useNativeImageBitmap(enable: boolean): void

  #### Parameters

  - enable: boolean

  #### Returns void

  - Defined in lib/five/application/five.ts:126

### `Static` version

- get version(): string

  #### Returns string

  - Defined in lib/five/application/five.ts:101

## Methods

### addExtraElement

- addExtraElement(element: HTMLElement): () => void

  绑定一个额外 DOM 区域，接受触控/鼠标事件

  #### Parameters

  - element: HTMLElement

  #### Returns () => void

  解除该绑定

  - Defined in lib/five/application/five.ts:775

### addPass

- addPass(pass: Pass): void

  增加后处理PASS

  #### Parameters

  - pass: Pass

    要添加的Pass实例

  #### Returns void

  - Defined in lib/five/application/five.ts:2818

### appendTo

- appendTo(element: HTMLElement, size?: { height?: number; width?: number }): void

  将显示区域加载到页面 DOM 中

  #### Parameters

  - element: HTMLElement

    加载到页面的 DOM 元素

  - size: { height?: number; width?: number } = {}

    显示区域尺寸 默认铺满这个 DOM 元素

  #### Returns void

  #### Description

  如果你是传入的 `renderer`. 则你需要自行来方式显示区域该方法并不生效

  - Defined in lib/five/application/five.ts:706

### changeMode

- changeMode<T extends Mode>(
  mode: T,
  state?: Partial<Omit<State, "mode">>,
  options?: number | { duration?: number; effect?: MovePanoEffect },
  userAction?: boolean,
  force?: boolean,
  ): Promise<void>

  切换模态

  #### Type Parameters

  - T extends Mode

  #### Parameters

  - mode: T

    切换到的模态

  - state: Partial<Omit<State, "mode">> = {}

    切换完成时的姿态

  - `Optional` options: number | { duration?: number; effect?: MovePanoEffect }

    模态切换动画用时

  - userAction: boolean = true

    是否时用户动作触发 默认 true

  - force: boolean = false

    必须重新初始化 controller

  #### Returns Promise<void>

  - Defined in lib/five/application/five.ts:1298

### dispose

- dispose(): void

  析构 five 对象。

  #### Returns void

  #### Description

  一旦调用了析构方法，则不能再使用当前 five 对象了。 你可以新建一个新的。

  - Defined in lib/five/application/five.ts:527

### emit

- emit<
  K extends
  | "dispose"
  | "error"
  | "render"
  | "gesture.pan"
  | "gesture.tap"
  | "gesture.dbltap"
  | "gesture.press"
  | "gesture.pinch"
  | "gesture.mousewheel"
  | "gesture.mousemove"
  | "gesture.momentum"
  | "gesture.fire"
  | "initAnimation.start"
  | "initAnimation.end"
  | "camera.update"
  | "intersect.update"
  | "pano.select"
  | "pano.request"
  | "pano.prepare"
  | "pano.moveTo"
  | "pano.moving"
  | "pano.arrived"
  | "pano.cancel"
  | "pano.error"
  | "pano.texture.load"
  | "pano.texture.progress"
  | "pano.texture.success"
  | "pano.texture.error"
  | "pano.texture.abort"
  | "xr.session.end"
  | "xr.session.start"
  | "xr.gesture.tap"
  | "xr.gesture.press"
  | "xr.gesture.buttonUp"
  | "xr.gesture.buttonDown"
  | "xr.controller.update"
  | (keyof LegacyEventType)
  | "works.request"
  | "works.load"
  | "works.ready"
  | "state.set"
  | "state.change"
  | "state.synced"
  | "currentState.change"
  | "model.request"
  | "model.load"
  | "model.error"
  | "model.changeShownFloor"
  | "models.load"
  | "models.refined"
  | "models.tileLoad"
  | "models.tileUnload"
  | "render.prepare"
  | "mode.change.request"
  | "mode.change"
  | "helpers.visible"
  | "network.resource"
  | "fps",
  >(
  name: K,
  ...data: Parameters<EventTypes[K]>,
  ): boolean

  触发事件

  #### Type Parameters

  - K extends
    | "dispose"
    | "error"
    | "render"
    | "gesture.pan"
    | "gesture.tap"
    | "gesture.dbltap"
    | "gesture.press"
    | "gesture.pinch"
    | "gesture.mousewheel"
    | "gesture.mousemove"
    | "gesture.momentum"
    | "gesture.fire"
    | "initAnimation.start"
    | "initAnimation.end"
    | "camera.update"
    | "intersect.update"
    | "pano.select"
    | "pano.request"
    | "pano.prepare"
    | "pano.moveTo"
    | "pano.moving"
    | "pano.arrived"
    | "pano.cancel"
    | "pano.error"
    | "pano.texture.load"
    | "pano.texture.progress"
    | "pano.texture.success"
    | "pano.texture.error"
    | "pano.texture.abort"
    | "xr.session.end"
    | "xr.session.start"
    | "xr.gesture.tap"
    | "xr.gesture.press"
    | "xr.gesture.buttonUp"
    | "xr.gesture.buttonDown"
    | "xr.controller.update"
    | (keyof LegacyEventType)
    | "works.request"
    | "works.load"
    | "works.ready"
    | "state.set"
    | "state.change"
    | "state.synced"
    | "currentState.change"
    | "model.request"
    | "model.load"
    | "model.error"
    | "model.changeShownFloor"
    | "models.load"
    | "models.refined"
    | "models.tileLoad"
    | "models.tileUnload"
    | "render.prepare"
    | "mode.change.request"
    | "mode.change"
    | "helpers.visible"
    | "network.resource"
    | "fps"

    预设的监听事件名称

  #### Parameters

  - name: K

    事件类型

  - ...data: Parameters<EventTypes[K]>

    触发事件的数据

  #### Returns boolean

  canceled 是否被触发取消

  Inherited from Subscribe.emit

  - Defined in lib/five/utils/subscribe.ts:131

### exitFullscreen

- exitFullscreen(): void

  退出全屏

  #### Returns void

  - Defined in lib/five/application/five.ts:2452

### getCameraLocal

- getCameraLocal(): { lookAtVector: Vector3; phi: number; theta: number } | null

  获取当前相机的姿态（用于内部的 python 脚本截图）

  #### Returns { lookAtVector: Vector3; phi: number; theta: number } | null

  #### Deprecated

  这是用于内部的 python 脚本截图

  - Defined in lib/five/application/five.ts:2788

### getCurrentState

- getCurrentState(): State

  #### Returns State

  - Defined in lib/five/application/five.ts:2058

### getDrawingBufferSize

- getDrawingBufferSize(target: Vector2): Vector2

  #### Parameters

  - target: Vector2

  #### Returns Vector2

  - Defined in lib/five/application/five.ts:807

### getElement

- getElement(): HTMLCanvasElement | undefined

  获取显示用的画布（Canvas DOM节点）

  #### Returns HTMLCanvasElement | undefined

  - Defined in lib/five/application/five.ts:1682

### getLongitudeAndLatitude

- getLongitudeAndLatitude(): Pick<Pose, "longitude" | "latitude">

  获取当前相机经纬度

  #### Returns Pick<Pose, "longitude" | "latitude">

  #### Deprecated

  请使用使用 getPose

  - Defined in lib/five/application/five.ts:2771

### getOffset

- getOffset(): Vector3

  获取当前相机位置

  #### Returns Vector3

  #### Deprecated

  请使用使用 getPose

  - Defined in lib/five/application/five.ts:2780

### getPixels

- getPixels<
  T extends
  Uint8Array<ArrayBufferLike>
  | Uint8ClampedArray<ArrayBufferLike> = Uint8Array<ArrayBufferLike>,
  >(
  x: number,
  y: number,
  width: number,
  height: number,
  pixelRatio?: number,
  flipY?: boolean,
  buffer?: T,
  ): T

  获取画面中的像素颜色

  #### Type Parameters

  - T extends Uint8Array<ArrayBufferLike> | Uint8ClampedArray<ArrayBufferLike> = Uint8Array<ArrayBufferLike>

  #### Parameters

  - x: number

    获取像素区域的起始坐标 x

  - y: number

    获取像素区域的起始坐标 y

  - width: number

    获取像素区域的宽度

  - height: number

    获取像素区域的高度

  - `Optional` pixelRatio: number

    获取区域的像素比

  - `Optional` flipY: boolean

    是否Y轴翻转

  - `Optional` buffer: T

    存储数组

  #### Returns T

  rgba颜色平铺的 Uint8Array

  - Defined in lib/five/application/five.ts:1478
- getPixels<
  T extends
  Uint8Array<ArrayBufferLike>
  | Uint8ClampedArray<ArrayBufferLike> = Uint8Array<ArrayBufferLike>,
  >(
  options: {
  buffer?: T;
  flipY?: boolean;
  height: number;
  helperVisible?: boolean;
  pixelRatio?: number;
  skipPanorama?: boolean;
  width: number;
  x: number;
  y: number;
  },
  ): T

  获取画面中的像素颜色

  #### Type Parameters

  - T extends Uint8Array<ArrayBufferLike> | Uint8ClampedArray<ArrayBufferLike> = Uint8Array<ArrayBufferLike>

  #### Parameters

  - options: {
    buffer?: T;
    flipY?: boolean;
    height: number;
    helperVisible?: boolean;
    pixelRatio?: number;
    skipPanorama?: boolean;
    width: number;
    x: number;
    y: number;
    }

    参数

    - ##### `Optional` buffer?: T

      存储数组

    - ##### `Optional` flipY?: boolean

      是否Y轴翻转

    - ##### height: number

      获取像素区域的高度

    - ##### `Optional` helperVisible?: boolean

    - ##### `Optional` pixelRatio?: number

      获取区域的像素比

    - ##### `Optional` skipPanorama?: boolean

    - ##### width: number

      获取像素区域的宽度

    - ##### x: number

      获取像素区域的起始坐标 x

    - ##### y: number

      获取像素区域的起始坐标 y

  #### Returns T

  - Defined in lib/five/application/five.ts:1492

### getPose

- getPose(): Pose

  #### Returns Pose

  #### Deprecated

  获取当前相机姿态, 可以使用 getCurrentState 代替

  - Defined in lib/five/application/five.ts:2762

### getSize

- getSize(target: Vector2): Vector2

  #### Parameters

  - target: Vector2

  #### Returns Vector2

  - Defined in lib/five/application/five.ts:797

### hasListener

- hasListener(
  name:
  | "dispose"
  | "error"
  | "render"
  | "gesture.pan"
  | "gesture.tap"
  | "gesture.dbltap"
  | "gesture.press"
  | "gesture.pinch"
  | "gesture.mousewheel"
  | "gesture.mousemove"
  | "gesture.momentum"
  | "gesture.fire"
  | "initAnimation.start"
  | "initAnimation.end"
  | "camera.update"
  | "intersect.update"
  | "pano.select"
  | "pano.request"
  | "pano.prepare"
  | "pano.moveTo"
  | "pano.moving"
  | "pano.arrived"
  | "pano.cancel"
  | "pano.error"
  | "pano.texture.load"
  | "pano.texture.progress"
  | "pano.texture.success"
  | "pano.texture.error"
  | "pano.texture.abort"
  | "xr.session.end"
  | "xr.session.start"
  | "xr.gesture.tap"
  | "xr.gesture.press"
  | "xr.gesture.buttonUp"
  | "xr.gesture.buttonDown"
  | "xr.controller.update"
  | (keyof LegacyEventType)
  | "works.request"
  | "works.load"
  | "works.ready"
  | "state.set"
  | "state.change"
  | "state.synced"
  | "currentState.change"
  | "model.request"
  | "model.load"
  | "model.error"
  | "model.changeShownFloor"
  | "models.load"
  | "models.refined"
  | "models.tileLoad"
  | "models.tileUnload"
  | "render.prepare"
  | "mode.change.request"
  | "mode.change"
  | "helpers.visible"
  | "network.resource"
  | "fps",
  ): boolean

  判断是否注册了事件

  #### Parameters

  - name:
    | "dispose"
    | "error"
    | "render"
    | "gesture.pan"
    | "gesture.tap"
    | "gesture.dbltap"
    | "gesture.press"
    | "gesture.pinch"
    | "gesture.mousewheel"
    | "gesture.mousemove"
    | "gesture.momentum"
    | "gesture.fire"
    | "initAnimation.start"
    | "initAnimation.end"
    | "camera.update"
    | "intersect.update"
    | "pano.select"
    | "pano.request"
    | "pano.prepare"
    | "pano.moveTo"
    | "pano.moving"
    | "pano.arrived"
    | "pano.cancel"
    | "pano.error"
    | "pano.texture.load"
    | "pano.texture.progress"
    | "pano.texture.success"
    | "pano.texture.error"
    | "pano.texture.abort"
    | "xr.session.end"
    | "xr.session.start"
    | "xr.gesture.tap"
    | "xr.gesture.press"
    | "xr.gesture.buttonUp"
    | "xr.gesture.buttonDown"
    | "xr.controller.update"
    | (keyof LegacyEventType)
    | "works.request"
    | "works.load"
    | "works.ready"
    | "state.set"
    | "state.change"
    | "state.synced"
    | "currentState.change"
    | "model.request"
    | "model.load"
    | "model.error"
    | "model.changeShownFloor"
    | "models.load"
    | "models.refined"
    | "models.tileLoad"
    | "models.tileUnload"
    | "render.prepare"
    | "mode.change.request"
    | "mode.change"
    | "helpers.visible"
    | "network.resource"
    | "fps"

    事件类型

  #### Returns boolean

  Inherited from Subscribe.hasListener

  - Defined in lib/five/utils/subscribe.ts:44

### insertPass

- insertPass(pass: Pass, index: number): void

  在指定位置插入后处理Pass

  #### Parameters

  - pass: Pass

    要插入的Pass实例

  - index: number

    插入位置的索引

  #### Returns void

  - Defined in lib/five/application/five.ts:2838

### load

- load(
  inputWork:
  | string
  | string[]
  | LooseWork
  | Work
  | Work[]
  | LooseWork[]
  | LooseWorkWithExtrinsics[]
  | Promise<
  LooseWork
  | Work
  | Work[]
  | LooseWork[]
  | LooseWorkWithExtrinsics[],
  >,
  state?: "initial" | "inherit" | Partial<State>,
  options?: number | FiveLoadOptions,
  userAction?: boolean,
  ): Promise<void>

  加载 Work 数据

  #### Parameters

  - inputWork:
    | string
    | string[]
    | LooseWork
    | Work
    | Work[]
    | LooseWork[]
    | LooseWorkWithExtrinsics[]
    | Promise<
    LooseWork
    | Work
    | Work[]
    | LooseWork[]
    | LooseWorkWithExtrinsics[],
    >

    Work 数据

  - `Optional` state: "initial" | "inherit" | Partial<State>

    初始化姿态

    - "inherit" 使用当前姿态
    - "initial" 使用 Work 数据中的 initial 姿态
    - State 自定义姿态
  - `Optional` options: number | FiveLoadOptions

    切换时间, 切换效果

  - userAction: boolean = true

  #### Returns Promise<void>

  - Defined in lib/five/application/five.ts:885

### moveToPano

- moveToPano(
  pano: number | Pano | `${string}[${number}]`,
  options?: MovePanoOptions,
  userAction?: boolean,
  ): Promise<void>

  转化到 Panorama 模态，并移动到对应序号的观察点。

  #### Parameters

  - pano: number | Pano | `${string}[${number}]`

    观察点序号

  - options: MovePanoOptions = {}

    移动点位参数

  - userAction: boolean = true

    是否用户触犯

  #### Returns Promise<void>

  - Defined in lib/five/application/five.ts:1949

### off

- off<
  K extends
  | "dispose"
  | "error"
  | "render"
  | "gesture.pan"
  | "gesture.tap"
  | "gesture.dbltap"
  | "gesture.press"
  | "gesture.pinch"
  | "gesture.mousewheel"
  | "gesture.mousemove"
  | "gesture.momentum"
  | "gesture.fire"
  | "initAnimation.start"
  | "initAnimation.end"
  | "camera.update"
  | "intersect.update"
  | "pano.select"
  | "pano.request"
  | "pano.prepare"
  | "pano.moveTo"
  | "pano.moving"
  | "pano.arrived"
  | "pano.cancel"
  | "pano.error"
  | "pano.texture.load"
  | "pano.texture.progress"
  | "pano.texture.success"
  | "pano.texture.error"
  | "pano.texture.abort"
  | "xr.session.end"
  | "xr.session.start"
  | "xr.gesture.tap"
  | "xr.gesture.press"
  | "xr.gesture.buttonUp"
  | "xr.gesture.buttonDown"
  | "xr.controller.update"
  | (keyof LegacyEventType)
  | "works.request"
  | "works.load"
  | "works.ready"
  | "state.set"
  | "state.change"
  | "state.synced"
  | "currentState.change"
  | "model.request"
  | "model.load"
  | "model.error"
  | "model.changeShownFloor"
  | "models.load"
  | "models.refined"
  | "models.tileLoad"
  | "models.tileUnload"
  | "render.prepare"
  | "mode.change.request"
  | "mode.change"
  | "helpers.visible"
  | "network.resource"
  | "fps",
  >(
  name?: K,
  callback?: (
  ...args: Parameters<EventTypes[K]>,
  ) => ReturnType<EventTypes[K]>,
  ): void

  解除事件

  如果 name 不传的话解除对应所有事件 如果 name, callback 不传的话解除所有name的所有事件

  #### Type Parameters

  - K extends
    | "dispose"
    | "error"
    | "render"
    | "gesture.pan"
    | "gesture.tap"
    | "gesture.dbltap"
    | "gesture.press"
    | "gesture.pinch"
    | "gesture.mousewheel"
    | "gesture.mousemove"
    | "gesture.momentum"
    | "gesture.fire"
    | "initAnimation.start"
    | "initAnimation.end"
    | "camera.update"
    | "intersect.update"
    | "pano.select"
    | "pano.request"
    | "pano.prepare"
    | "pano.moveTo"
    | "pano.moving"
    | "pano.arrived"
    | "pano.cancel"
    | "pano.error"
    | "pano.texture.load"
    | "pano.texture.progress"
    | "pano.texture.success"
    | "pano.texture.error"
    | "pano.texture.abort"
    | "xr.session.end"
    | "xr.session.start"
    | "xr.gesture.tap"
    | "xr.gesture.press"
    | "xr.gesture.buttonUp"
    | "xr.gesture.buttonDown"
    | "xr.controller.update"
    | (keyof LegacyEventType)
    | "works.request"
    | "works.load"
    | "works.ready"
    | "state.set"
    | "state.change"
    | "state.synced"
    | "currentState.change"
    | "model.request"
    | "model.load"
    | "model.error"
    | "model.changeShownFloor"
    | "models.load"
    | "models.refined"
    | "models.tileLoad"
    | "models.tileUnload"
    | "render.prepare"
    | "mode.change.request"
    | "mode.change"
    | "helpers.visible"
    | "network.resource"
    | "fps"

    预设的监听事件名称

  #### Parameters

  - `Optional` name: K

    事件类型

  - `Optional` callback: (...args: Parameters<EventTypes[K]>) => ReturnType<EventTypes[K]>

    事件回调函数

  #### Returns void

  Inherited from Subscribe.off

  - Defined in lib/five/utils/subscribe.ts:97

### on

- on<
  K extends
  | "dispose"
  | "error"
  | "render"
  | "gesture.pan"
  | "gesture.tap"
  | "gesture.dbltap"
  | "gesture.press"
  | "gesture.pinch"
  | "gesture.mousewheel"
  | "gesture.mousemove"
  | "gesture.momentum"
  | "gesture.fire"
  | "initAnimation.start"
  | "initAnimation.end"
  | "camera.update"
  | "intersect.update"
  | "pano.select"
  | "pano.request"
  | "pano.prepare"
  | "pano.moveTo"
  | "pano.moving"
  | "pano.arrived"
  | "pano.cancel"
  | "pano.error"
  | "pano.texture.load"
  | "pano.texture.progress"
  | "pano.texture.success"
  | "pano.texture.error"
  | "pano.texture.abort"
  | "xr.session.end"
  | "xr.session.start"
  | "xr.gesture.tap"
  | "xr.gesture.press"
  | "xr.gesture.buttonUp"
  | "xr.gesture.buttonDown"
  | "xr.controller.update"
  | (keyof LegacyEventType)
  | "works.request"
  | "works.load"
  | "works.ready"
  | "state.set"
  | "state.change"
  | "state.synced"
  | "currentState.change"
  | "model.request"
  | "model.load"
  | "model.error"
  | "model.changeShownFloor"
  | "models.load"
  | "models.refined"
  | "models.tileLoad"
  | "models.tileUnload"
  | "render.prepare"
  | "mode.change.request"
  | "mode.change"
  | "helpers.visible"
  | "network.resource"
  | "fps",
  >(
  name: K,
  callback: (
  this: this,
  ...args: Parameters<EventTypes[K]>,
  ) => ReturnType<EventTypes[K]>,
  once?: boolean,
  ): () => void

  注册事件

  #### Type Parameters

  - K extends
    | "dispose"
    | "error"
    | "render"
    | "gesture.pan"
    | "gesture.tap"
    | "gesture.dbltap"
    | "gesture.press"
    | "gesture.pinch"
    | "gesture.mousewheel"
    | "gesture.mousemove"
    | "gesture.momentum"
    | "gesture.fire"
    | "initAnimation.start"
    | "initAnimation.end"
    | "camera.update"
    | "intersect.update"
    | "pano.select"
    | "pano.request"
    | "pano.prepare"
    | "pano.moveTo"
    | "pano.moving"
    | "pano.arrived"
    | "pano.cancel"
    | "pano.error"
    | "pano.texture.load"
    | "pano.texture.progress"
    | "pano.texture.success"
    | "pano.texture.error"
    | "pano.texture.abort"
    | "xr.session.end"
    | "xr.session.start"
    | "xr.gesture.tap"
    | "xr.gesture.press"
    | "xr.gesture.buttonUp"
    | "xr.gesture.buttonDown"
    | "xr.controller.update"
    | (keyof LegacyEventType)
    | "works.request"
    | "works.load"
    | "works.ready"
    | "state.set"
    | "state.change"
    | "state.synced"
    | "currentState.change"
    | "model.request"
    | "model.load"
    | "model.error"
    | "model.changeShownFloor"
    | "models.load"
    | "models.refined"
    | "models.tileLoad"
    | "models.tileUnload"
    | "render.prepare"
    | "mode.change.request"
    | "mode.change"
    | "helpers.visible"
    | "network.resource"
    | "fps"

    预设的监听事件名称

  #### Parameters

  - name: K

    事件类型

  - callback: (this: this, ...args: Parameters<EventTypes[K]>) => ReturnType<EventTypes[K]>

    事件回调函数

  - `Optional` once: boolean

    是否只执行一次

  #### Returns () => void

  解除事件

  Inherited from Subscribe.on

  - Defined in lib/five/utils/subscribe.ts:58

### once

- once<
  K extends
  | "dispose"
  | "error"
  | "render"
  | "gesture.pan"
  | "gesture.tap"
  | "gesture.dbltap"
  | "gesture.press"
  | "gesture.pinch"
  | "gesture.mousewheel"
  | "gesture.mousemove"
  | "gesture.momentum"
  | "gesture.fire"
  | "initAnimation.start"
  | "initAnimation.end"
  | "camera.update"
  | "intersect.update"
  | "pano.select"
  | "pano.request"
  | "pano.prepare"
  | "pano.moveTo"
  | "pano.moving"
  | "pano.arrived"
  | "pano.cancel"
  | "pano.error"
  | "pano.texture.load"
  | "pano.texture.progress"
  | "pano.texture.success"
  | "pano.texture.error"
  | "pano.texture.abort"
  | "xr.session.end"
  | "xr.session.start"
  | "xr.gesture.tap"
  | "xr.gesture.press"
  | "xr.gesture.buttonUp"
  | "xr.gesture.buttonDown"
  | "xr.controller.update"
  | (keyof LegacyEventType)
  | "works.request"
  | "works.load"
  | "works.ready"
  | "state.set"
  | "state.change"
  | "state.synced"
  | "currentState.change"
  | "model.request"
  | "model.load"
  | "model.error"
  | "model.changeShownFloor"
  | "models.load"
  | "models.refined"
  | "models.tileLoad"
  | "models.tileUnload"
  | "render.prepare"
  | "mode.change.request"
  | "mode.change"
  | "helpers.visible"
  | "network.resource"
  | "fps",
  >(
  name: K,
  callback: (
  this: this,
  ...args: Parameters<EventTypes[K]>,
  ) => ReturnType<EventTypes[K]>,
  ): () => void

  注册事件(是否只执行一次)

  #### Type Parameters

  - K extends
    | "dispose"
    | "error"
    | "render"
    | "gesture.pan"
    | "gesture.tap"
    | "gesture.dbltap"
    | "gesture.press"
    | "gesture.pinch"
    | "gesture.mousewheel"
    | "gesture.mousemove"
    | "gesture.momentum"
    | "gesture.fire"
    | "initAnimation.start"
    | "initAnimation.end"
    | "camera.update"
    | "intersect.update"
    | "pano.select"
    | "pano.request"
    | "pano.prepare"
    | "pano.moveTo"
    | "pano.moving"
    | "pano.arrived"
    | "pano.cancel"
    | "pano.error"
    | "pano.texture.load"
    | "pano.texture.progress"
    | "pano.texture.success"
    | "pano.texture.error"
    | "pano.texture.abort"
    | "xr.session.end"
    | "xr.session.start"
    | "xr.gesture.tap"
    | "xr.gesture.press"
    | "xr.gesture.buttonUp"
    | "xr.gesture.buttonDown"
    | "xr.controller.update"
    | (keyof LegacyEventType)
    | "works.request"
    | "works.load"
    | "works.ready"
    | "state.set"
    | "state.change"
    | "state.synced"
    | "currentState.change"
    | "model.request"
    | "model.load"
    | "model.error"
    | "model.changeShownFloor"
    | "models.load"
    | "models.refined"
    | "models.tileLoad"
    | "models.tileUnload"
    | "render.prepare"
    | "mode.change.request"
    | "mode.change"
    | "helpers.visible"
    | "network.resource"
    | "fps"

    预设的监听事件名称

  #### Parameters

  - name: K

    事件类型

  - callback: (this: this, ...args: Parameters<EventTypes[K]>) => ReturnType<EventTypes[K]>

    事件回调函数

  #### Returns () => void

  解除事件

  Inherited from Subscribe.once

  - Defined in lib/five/utils/subscribe.ts:81

### pause

- pause(): void

  暂停自动播放

  #### Returns void

  - Defined in lib/five/application/five.ts:1931

### play

- play(): void

  #### Returns void

  - Defined in lib/five/application/five.ts:1938

### preloadPano

- preloadPano(
  pano: number | Pano | `${string}[${number}]`,
  callback?: (costs: number) => void,
  ): Promise<number>

  预加载点位图片资源

  #### Parameters

  - pano: number | Pano | `${string}[${number}]`

    观察点序号

  - callback: (costs: number) => void = noop

    加载完成回调, 并传递加载用时。

  #### Returns Promise<number>

  加载完成的 Promise 参数同 callback

  - Defined in lib/five/application/five.ts:2002

### project2d

- project2d(vector: Vector3, testModel?: boolean): Vector2 | null

  计算三维坐标对应到屏幕的二维坐标

  #### Parameters

  - vector: Vector3

    三维坐标

  - testModel: boolean = false

    是否计算模型遮挡

  #### Returns Vector2 | null

  二维坐标 或者 null

  #### Description

  如果三维坐标不在屏幕中，则返回 null

  - Defined in lib/five/application/five.ts:2037

### ready

- ready(args?: { tile?: boolean }): Promise<void>

  当前页面静态

  #### Parameters

  - args: { tile?: boolean } = {}

  #### Returns Promise<void>

  - Defined in lib/five/application/five.ts:2425

### refresh

- refresh(size?: { height?: number; width?: number }, pixelRatio?: number): void

  设置显示区域尺寸

  #### Parameters

  - size: { height?: number; width?: number } = {}

    显示区域尺寸 默认铺满这个 DOM 元素

  - `Optional` pixelRatio: number

    像素比 默认继承之前的设置

  #### Returns void

  #### Description

  如果你是传入的 `renderer`. 则你需要自行来设置显示区域尺寸，该方法并不生效

  - Defined in lib/five/application/five.ts:735

### removeExtraElement

- removeExtraElement(element: HTMLElement): void

  解除绑定的一个额外 DOM 区域

  #### Parameters

  - element: HTMLElement

  #### Returns void

  - Defined in lib/five/application/five.ts:788

### removePass

- removePass(pass: Pass): void

  移除后处理Pass

  #### Parameters

  - pass: Pass

    要移除的Pass实例

  #### Returns void

  - Defined in lib/five/application/five.ts:2826

### render

- render(callback?: () => void): void

  强制渲染

  #### Parameters

  - `Optional` callback: () => void

    渲染完成回调

  #### Returns void

  #### Description

  调用 `five.render()` 和设置 `five.needsRender = true` 均可在按需渲染时，使得画面渲染一次 区别在于：

  - `five.needsRender = true` 为在下帧渲染画面
  - `five.render()` 在当前帧渲染画面 推荐使用 `five.needsRender = true`, 可以更加流畅。但是如果需要截图等同步操作，可以使用 `five.render()`
  - Defined in lib/five/application/five.ts:1697

### requestFullscreen

- requestFullscreen(): void

  请求全屏

  #### Returns void

  - Defined in lib/five/application/five.ts:2441

### reset

- reset(): Promise<void>

  #### Returns Promise<void>

  - Defined in lib/five/application/five.ts:1230

### reset_

- reset_(): Promise<void>

  #### Returns Promise<void>

  - Defined in lib/five/application/five.ts:1240

### setScissor

- setScissor(scissor: Viewport): void

  #### Parameters

  - scissor: Viewport

  #### Returns void

  #### Deprecated

  use setViewport instead.

  - Defined in lib/five/application/five.ts:2754

### setState

- setState(
  state: Partial<State>,
  immediately?: boolean,
  userAction?: boolean,
  ): void

  设置 State

  #### Parameters

  - state: Partial<State>

    目标状态

  - immediately: boolean = false

    是否马上转换，马上转换会尽快达到目标状态，尽量减少中间状态，更少动画。

  - userAction: boolean = true

    是否是用户触发的动作

  #### Returns void

  #### Description

      five 设置了以下状态

      - mode: Mode
      - panoIndex: number
      - longitude: number
      - latitude: number
      - distance: number
      - fov: number
      - offset: THREE.Vector3

      可以通过 five.state 和 five.setState 来获取和设置。
      通过 state 设置后，five 会通过合适的动画运动来达到设置的位置。
      来迎合一些通过数据驱动的场景。

  - Defined in lib/five/application/five.ts:2089

### setViewport

- setViewport(viewport: Viewport): void

  设置 `viewport`

  #### Parameters

  - viewport: Viewport

    指定区域 `scissor` 是将屏幕中的内容渲染到 `renderer` 的指定区域。 请确保在 five 初始化时传入 `renderer` 对象 页面整体长宽均为 `1`。通过类似 css 的 `left` `bottom` `width` `height` 来确定区域。

  #### Returns void

  #### Example

      five.setViewport({ left: 0.75, bottom: 0, width: 0.25, height: 1 })

  - Defined in lib/five/application/five.ts:592

### updateCamera

- updateCamera(
  pose: Partial<Pose>,
  duration: number,
  userAction?: boolean,
  ): Promise<void>

  移动相机。（不触发点位移动）

  #### Parameters

  - pose: Partial<Pose>

    相机目标位置

  - duration: number

    动画触发的时常

  - userAction: boolean = true

    是否用户触发

  #### Returns Promise<void>

  Promise 是否移动成功

  #### Description

  如果动画中途被打断（用户触发行为，或者调用 setState, load, changeMode）的等 会 Promise.reject。运动完成则 Promise.resolve

  - Defined in lib/five/application/five.ts:827

### updateCameraWithKeyframes

- updateCameraWithKeyframes(
  keyframes: { key?: string; progress: number; value: Pose }[],
  duration: number,
  userAction?: boolean,
  ): Promise<void>

  通过帧动画移动相机。（不触发点位移动）

  #### Parameters

  - keyframes: { key?: string; progress: number; value: Pose }[]

    动画帧

  - duration: number

    动画触发的时常

  - userAction: boolean = true

    是否用户触发

  #### Returns Promise<void>

  Promise 是否移动成功

  #### Description

  如果动画中途被打断（用户触发行为，或者调用 setState, load, changeMode）的等 会 Promise.reject。运动完成则 Promise.resolve

  - Defined in lib/five/application/five.ts:844

### updateConfiguration

- updateConfiguration(
  args: Pick<
  FiveInitArgs,
  | "panorama"
  | "model"
  | "floorplan"
  | "topview"
  | "mapview"
  | "vrPanorama"
  | "xrPanorama"
  | "imageOptions"
  | "textureOptions",
  >,
  refresh?: boolean,
  ): void

  #### Parameters

  - args: Pick<
    FiveInitArgs,
    | "panorama"
    | "model"
    | "floorplan"
    | "topview"
    | "mapview"
    | "vrPanorama"
    | "xrPanorama"
    | "imageOptions"
    | "textureOptions",
    >
  - refresh: boolean = true

  #### Returns void

  - Defined in lib/five/application/five.ts:621

### updateTime

- updateTime(time: number, deltaTime: number, ...args: any[]): void

  #### Parameters

  - time: number
  - deltaTime: number
  - ...args: any[]

  #### Returns void

  - Defined in lib/five/application/five.ts:1764

### waitUntil

- waitUntil<
  K extends
  | "dispose"
  | "error"
  | "render"
  | "gesture.pan"
  | "gesture.tap"
  | "gesture.dbltap"
  | "gesture.press"
  | "gesture.pinch"
  | "gesture.mousewheel"
  | "gesture.mousemove"
  | "gesture.momentum"
  | "gesture.fire"
  | "initAnimation.start"
  | "initAnimation.end"
  | "camera.update"
  | "intersect.update"
  | "pano.select"
  | "pano.request"
  | "pano.prepare"
  | "pano.moveTo"
  | "pano.moving"
  | "pano.arrived"
  | "pano.cancel"
  | "pano.error"
  | "pano.texture.load"
  | "pano.texture.progress"
  | "pano.texture.success"
  | "pano.texture.error"
  | "pano.texture.abort"
  | "xr.session.end"
  | "xr.session.start"
  | "xr.gesture.tap"
  | "xr.gesture.press"
  | "xr.gesture.buttonUp"
  | "xr.gesture.buttonDown"
  | "xr.controller.update"
  | (keyof LegacyEventType)
  | "works.request"
  | "works.load"
  | "works.ready"
  | "state.set"
  | "state.change"
  | "state.synced"
  | "currentState.change"
  | "model.request"
  | "model.load"
  | "model.error"
  | "model.changeShownFloor"
  | "models.load"
  | "models.refined"
  | "models.tileLoad"
  | "models.tileUnload"
  | "render.prepare"
  | "mode.change.request"
  | "mode.change"
  | "helpers.visible"
  | "network.resource"
  | "fps",
  >(
  name: K,
  filter?: (...args: Parameters<EventTypes[K]>) => boolean | void,
  ): Promise<Parameters<EventTypes[K]>>

  等待事件

  #### Type Parameters

  - K extends
    | "dispose"
    | "error"
    | "render"
    | "gesture.pan"
    | "gesture.tap"
    | "gesture.dbltap"
    | "gesture.press"
    | "gesture.pinch"
    | "gesture.mousewheel"
    | "gesture.mousemove"
    | "gesture.momentum"
    | "gesture.fire"
    | "initAnimation.start"
    | "initAnimation.end"
    | "camera.update"
    | "intersect.update"
    | "pano.select"
    | "pano.request"
    | "pano.prepare"
    | "pano.moveTo"
    | "pano.moving"
    | "pano.arrived"
    | "pano.cancel"
    | "pano.error"
    | "pano.texture.load"
    | "pano.texture.progress"
    | "pano.texture.success"
    | "pano.texture.error"
    | "pano.texture.abort"
    | "xr.session.end"
    | "xr.session.start"
    | "xr.gesture.tap"
    | "xr.gesture.press"
    | "xr.gesture.buttonUp"
    | "xr.gesture.buttonDown"
    | "xr.controller.update"
    | (keyof LegacyEventType)
    | "works.request"
    | "works.load"
    | "works.ready"
    | "state.set"
    | "state.change"
    | "state.synced"
    | "currentState.change"
    | "model.request"
    | "model.load"
    | "model.error"
    | "model.changeShownFloor"
    | "models.load"
    | "models.refined"
    | "models.tileLoad"
    | "models.tileUnload"
    | "render.prepare"
    | "mode.change.request"
    | "mode.change"
    | "helpers.visible"
    | "network.resource"
    | "fps"

    预设的监听事件名称

  #### Parameters

  - name: K

    事件类型

  - `Optional` filter: (...args: Parameters<EventTypes[K]>) => boolean | void

    事件类型

  #### Returns Promise<Parameters<EventTypes[K]>>

  触发事件的数据

  Inherited from Subscribe.waitUntil

  - Defined in lib/five/utils/subscribe.ts:155