官方示例:Cesium Sandcastlehttps://sandcastle.cesium.com/?src=3D%20Models.html&label=Tutorials
glb模型下載:https://sandcastle.cesium.com/SampleData/models/CesiumAir/Cesium_Air.glb?
?文章來源:http://www.zghlxwxcb.cn/news/detail-507797.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-507797.html
<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, //關(guān)閉選擇指示器
shadows: true,
shouldAnimate: true, //模型顯示動(dòng)畫
});
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>
到了這里,關(guān)于cesium加載glb格式的3d模型的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!