SceneProjector

new Cesium.SceneProjector(options)

场景投影
Name Type Description
options Object
Name Type Default Description
scene Scene 场景对象 启用自定义渲染通道功能必须传入场景对象
pass Pass Cesium.Pass.ANALYSIS optional 渲染通道 自定义渲染通道只可设置 Pass.AFTER_GLOBEPass.AFTER_TILEPass.AFTER_TILE_CLASSIFICATIONPass.ANALYSIS 四个通道
source Color | String | HTMLVideoElement 投影资源 图片支持".png/.jpg/.jpeg" 视频支持".mp4/.m3u8"
viewPosition Cartesian3 观察点
targetPosition Cartesian3 目标点
direction Cartesian3 投影相机的朝向
up Cartesian3 投影相机的上方向
heading Number 投影相机的偏向角度 角度制
pitch Number 投影相机的俯仰角度 角度制
roll Number 投影相机的翻滚角度 角度制
showLine Boolean 视锥体是否显示
hideVPInvisible Boolean 观察点(viewPosition)不可见时隐藏视频投影
Example:
var viewer = new Cesium.Viewer('cesiumContainer', {});
var scene = viewer.scene;

// 1. 通过viewPosition + targetPosition创建视频投影
var type = Cesium.SceneProjectorType.VIDEO;
var scenePro = new Cesium.SceneProjector({
     scene: scene,// 开启自定义渲染通道功能
     pass: Cesium.Pass.AFTER_TILE, // 自定义渲染通道瓦片渲染后,视频投放将绘制在M3D模型之上,贴模型覆盖物之下
     viewPosition: new Cesium.Carteaian3(
         -2340650.4879239253,
         4555000.890380713,
         3789431.271813441
     ),
     targetPosition: new Cesium.Carteaian3(
         -2340573.747400027,
         4554853.496182831,
         3789311.823992698
     ),
     source: '../videos/DJI_0008.mp4'
})

// 2. 通过viewPosition + heading,pitch,roll创建视频投影
var scenePro = new Cesium.SceneProjector({
     scene: scene,
     viewPosition: new Cesium.Carteaian3(
         -2340650.4879239253,
         4555000.890380713,
         3789431.271813441
     ),
     heading: 40,
     pitch: -40
     roll: 0,
     source: '../videos/DJI_0008.mp4'
})

// 3. 通过viewPosition + direction,up创建视频投影
var direction = new Cesium.Cartesian3(1, 0, 0);
var up = new Cesium.Cartesian3(0, 0, 1);

var scenePro = new Cesium.SceneProjector({
     scene: scene,
     viewPosition: new Cesium.Carteaian3(
         -2340650.4879239253,
         4555000.890380713,
         3789431.271813441
     ),
     direction: direction,
     up: up,
     source: '../videos/DJI_0008.mp4'
})

// 4. 外部传入video标签
var scenePro;
var externalVideo = document.createElement('video');
document.body.append(externalVideo);
externalVideo.style.position = 'absolute';
externalVideo.style.bottom = '75px';
externalVideo.style.right = '0';
externalVideo.style.width = '320px';
externalVideo.style.height = '180px';
externalVideo.crossOrigin = 'anonymous';
externalVideo.play();
externalVideo.src = "../videos/DJI_0008.mp4";
scenePro = new Cesium.SceneProjector({
     scene: scene,
     viewPosition: new Cesium.Carteaian3(
         -2340650.4879239253,
         4555000.890380713,
         3789431.271813441
     ),
     heading: 40,
     pitch: -40
     roll: 0,
     source: externalVideo
})

Members

投影纹理背后剔除
Default Value: true

deprecated defaultPlaybackRate : Number

设置或返回视频的默认播放速度。

Deprecated: 已过时,未来会被删除。 请使用videoHTML获取video标签控制

视频投放远裁剪平面 最小值被限制为(nearClipPlane + 1)。
方位角

deprecated heightViewPosition : Number

观察点同目标点的距离 配合SceneProjector#rectangleSceneProjector#polygon使用

Deprecated: 已过时,未来会被删除。

hideVPInvisible : Boolean

当viewPosition不在屏幕内时是否隐藏投影

horizontAngle : Number

水平广角

deprecated isLoop : Boolean

设置当前视频是否循环播放

Deprecated: 已过时,未来会被删除。 请使用videoHTML获取video标签控制

deprecated isMuted : Boolean

设置或返回 当前视频是否播放声音

Deprecated: 已过时,未来会被删除。 请使用videoHTML获取video标签控制

deprecated isPaused : Boolean

设置或返回当前视频是否暂停

Deprecated: 已过时,未来会被删除。 请使用videoHTML获取video标签控制

nearClipPlane : Number

视频投放近裁剪平面 最小被限制为0.01,最大值被限制为(farClipPlane - 1)。
俯仰角

deprecated polygon : Array.<Cartesian3>

传入一个多边形区域,基于这个区域创建视频投放,不能保证投放结果与传入的多边形区域一致

Deprecated: 已过时,未来会被删除。

readonly projectionCamera : Camera

投影相机

projectionSource : Color|String|HTMLVideoElement

投影资源 图片支持".png/.jpg/.jpeg" 视频支持".mp4/.m3u8"
Example:
// 动态替换HTMLVideoElement时要特别注意停下旧video标签
// 否则旧的HTMLVideoElement标签的'canplay'事件在循环时会持续回调
// 导致videoReady在不合适的时机变为true
if(externalVideo){ // 旧的HTMLVideoElement
     externalVideo.pause();
     externalVideo.removeAttribute('src');
     externalVideo.load();
}
var outVideo = document.createElement('video');
outVideo.crossOrigin = 'anonymous';
outVideo.loop = true;
scenePro.projectionSource = outVideo;

readonly deprecated projectorType : Number

投影类型

Deprecated: 已过时,未来会被删除,请勿使用。

deprecated rectangle : Array.<Cartesian3>

传入一个矩形区域,基于这个区域创建视频投放,不能保证投放结果与传入的矩形区域一致

Deprecated: 已过时,未来会被删除。

翻滚角
是否显示椎体线
投影相机观察的目标点

deprecated textureSource : String

投影文件资源

Deprecated: 已过时,请使用projectionSource代替

verticalAngle : Number

竖直广角

deprecated videoCurrentTime : Number

设置或返回 视频当前播放的时间位置 单位为秒 如果视频异常则返回-1

Deprecated: 已过时,未来会被删除。 请使用videoHTML获取video标签控制

readonly deprecated videoDuration : Number

返回视频的总时长 单位为秒 如果视频异常则返回-1

Deprecated: 已过时,未来会被删除。 请使用videoHTML获取video标签控制

readonly videoHTML : HTMLVideoElement

获取投影纹理视频流的HTMLVideo标签

deprecated videoTag : String

设置video的标签

Deprecated: 已过时,未来会被删除,请勿使用。

投影相机观察点
是否显示视频投放
Default Value: true

Methods

销毁视频投放