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 Description
options object
fov number

Camera frustum vertical field of view. Default 45.

aspect number

Camera frustum aspect ratio. Default window.innerWidth/window.innerHeight.

near number

Camera frustum near plane. Default 1.

far number

Camera frustum far plane. Default 10000000.

center Array

Camera center coordinate. Default [104.081701757991, 30.627042558105988].

axesHelper Array

Enabled axes Helper. Default false.

enableLighting Array

Enabled light. Default true.

threeHabit Array

Enabled threejs Habit(Left click to modify pitch). Default true.

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 });