Module

ThreeJs

接入three的融合模块 【注意】cesium 需要关闭自带的循环渲染(useDefaultRenderLoop: false)

Parameters:
Name Type Description
viewer object

cesium 实例

cesiumGlobal object

cesium 全局对象

Methods

# destroyThreeJS()

three对象销毁

Example
import { ThreeJs } from 'cesium_dev_kit'
const threeObj = new ThreeJs({
     cesiumGlobal: Cesium,
    threeGlobal: THREE,
    containerId: 'cesiumContainer',
    threeContainerId: 'threeContainer',
  })
threeObj.threeJs.destroyThreeJS();

# initThree(options) → {threeObj}

初始化three

Parameters:
Name Type Attributes Default Description
options object
fov number <optional>
45

Camera frustum vertical field of view.

aspect number <optional>
window.innerWidth/window.innerHeight

Camera frustum aspect ratio.

near number <optional>
1

Camera frustum near plane.

far number <optional>
10000000

Camera frustum far plane.

center Array <optional>
[104.081701757991, 30.627042558105988]

Camera center coordinate.

axesHelper Array <optional>
false

Enabled axes Helper.

enableLighting Array <optional>
true

Enabled light.

threeHabit Array <optional>
true

Enabled threejs Habit(Left click to modify pitch).

threeObj
Example
import { ThreeJs } from 'cesium_dev_kit'
const threeObj = new ThreeJs({
     cesiumGlobal: Cesium,
    threeGlobal: THREE,
    containerId: 'cesiumContainer',
    threeContainerId: 'threeContainer',
  })
  const { scene, camera } = threeObj.threeJs.initThree({ center, axesHelper: true, threeHabit: false });