Cesium支持什么格式?
????????Cesium支持的格式包括:3D模型格式(如COLLADA、gITF、OBJ)、影像格式(如JPEG、PNG、GeoTIFF)、地形格式(如STL、Heightmap)、矢量數(shù)據(jù)格式(如GeoJSON、KMZ)、時(shí)間動(dòng)態(tài)數(shù)據(jù)格式(如CZML),以及其他各種數(shù)據(jù)格式。此外,Cesium還通過(guò)插件支持其他特定格式。
Cesium加載Gltf模型
const position = Cesium.Cartesian3.fromDegrees(
91.18062333588327,
29.64956,
3640.0
);
viewer.scene.globe.depthTestAgainstTerrain = true;
const heading = Cesium.Math.toRadians(90); //135度轉(zhuǎn)弧度
const pitch = Cesium.Math.toRadians(0);
const roll = 0;
const hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
const orientation = Cesium.Transforms.headingPitchRollQuaternion(
position,
hpr
);
const entity = viewer.entities.add({
position: position,
orientation: orientation,
model: {
uri: "./assets/cesium_gltf/GLTF/M_BWG.gltf", //注意entitits.add方式加載gltf文件時(shí),這里是uri,不是url,并且這種方式只能加載.glb格式的文件
scale: 1.0, //縮放比例
minimumPixelSize: 128, //最小像素大小,可以避免太小看不見
maximumScale: 20000, //模型的最大比例尺大小。minimumPixelSize的上限
incrementallyLoadTextures: true, //加載模型后紋理是否可以繼續(xù)流入
runAnimations: true, //是否啟動(dòng)模型中制定的gltf動(dòng)畫
clampAnimations: true, //制定gltf動(dòng)畫是否在沒(méi)有關(guān)鍵幀的持續(xù)時(shí)間內(nèi)保持最后一個(gè)姿勢(shì)
// shadows: Cesium.ShadowMode.ENABLED,
heightReference: Cesium.HeightReference.NONE,
},
});
viewer.trackedEntity = entity; // 聚焦模型
viewer.flyTo(entity);
效果圖:文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-788779.html
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-788779.html
到了這里,關(guān)于vue結(jié)合Cesium加載gltf模型的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!