本文主要是介绍cesium加载glb格式的3d模型,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
官方示例:Cesium Sandcastlehttps://sandcastle.cesium.com/?src=3D%20Models.html&label=Tutorials
glb模型下载:https://sandcastle.cesium.com/SampleData/models/CesiumAir/Cesium_Air.glb
<template><div style="height: 100vh"><div id="cesiumContainer" /></div>
</template><script>
export default {name: "test",data() {return {};},mounted() {const viewer = new Cesium.Viewer("cesiumContainer", {infoBox: false,selectionIndicator: false, //关闭选择指示器shadows: true,shouldAnimate: true, //模型显示动画});viewer.entities.removeAll();const position = Cesium.Cartesian3.fromDegrees(-123.0744619,44.0503706,5000.0);const heading = Cesium.Math.toRadians(135);const pitch = 0;const roll = 0;const hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);const orientation = Cesium.Transforms.headingPitchRollQuaternion(position,hpr);const entity = viewer.entities.add({name: "Cesium_Air",position: position,orientation: orientation,model: {uri: "Cesium_Air.glb",minimumPixelSize: 128,maximumScale: 20000,},});viewer.trackedEntity = entity;},
};
</script>
这篇关于cesium加载glb格式的3d模型的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!