原文链接及内容
效果如下图所示:

示例代码如下:这里把无关组件都做了隐藏,仅留下投影选择器。
注:
- 正交投影(orthographic projection):平行光线垂直于投影平面进行投影,保持了物体在不同深度上的比例不变。不具有近大远小的透视效果,所有平行线在投影后仍然平行。
- 透视投影(perspective projection):所有光线都汇聚于一个投影中心(相机位置),然后投影到投影平面上,产生近大远小的视觉效果。模拟人眼观察效果,近处的物体显得更大,远处的物体显得更小,更符合人眼对现实世界的感知。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| const viewer = new Cesium.Viewer("cesiumContainer", { geocoder: false, homeButton: false, sceneModePicker: false, navigationHelpButton: false, navigationInstructionsInitiallyVisible: false, animation: false, timeline: false, fullscreenButton: false, skyBox: false, shouldAnimate: true, baseLayerPicker: false, projectionPicker: true, }); viewer.cesiumWidget.creditContainer.style.display = "none";
viewer.projectionPicker.viewModel.switchToOrthographic();
const position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 0.0); const hpr = new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(135), 0.0, 0.0); const orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
const entity = viewer.entities.add({ position: position, orientation: orientation, model: { uri: "../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.glb", minimumPixelSize: 128, maximumScale: 20000, }, }); viewer.trackedEntity = entity;
|