单体化视频投影(视频融合)
将视频投影到模型上
引入插件
js
import ClassificationVideo from './ClassificationVideo.js'
加载视频
js
LSGlobe.Viewer.scene.logarithmicDepthBuffer = true
var inverseViewMatrix = ClassificationVideo.hpr2m({
position: LSGlobe.Cartesian3.fromDegrees(
119.4782162758187,
28.44205220819821,
500
),
heading: LSGlobe.Math.toRadians(-200),
pitch: LSGlobe.Math.toRadians(-70),
roll: LSGlobe.Math.toRadians(2)
})
LSGlobe.classificationVideo = new ClassificationVideo({
inverseViewMatrix: inverseViewMatrix,
videoElement: document.getElementById('trailer'), //获取video元素
showHelperPrimitive: true, //是否显示视锥体
frustum: new LSGlobe.PerspectiveFrustum({
fov: LSGlobe.Math.toRadians(60),
aspectRatio: 1,
near: 1,
far: 500
})
})
// LSGlobe.classificationVideo.alphaImage = this.maskImg
LSGlobe.Viewer.scene.primitives.add(LSGlobe.classificationVideo)
html
<video
id="trailer"
muted=""
autoplay=""
loop=""
crossorigin=""
controls=""
style="z-index: 1;"
>
<source src="" type="video/mp4" />
Your browser does not support the <code>video</code> element.
</video>
销毁
js
LSGlobe.classificationVideo.destroy()
LSGlobe.classificationVideo = undefined