cesium使用primitive添加模型 ,写出实现代码
时间: 2023-04-01 22:02:00 浏览: 189
可以使用以下代码实现cesium使用primitive添加模型:
```javascript
var viewer = new Cesium.Viewer('cesiumContainer');
var primitive = new Cesium.Primitive({
geometryInstances: new Cesium.GeometryInstance({
geometry: new Cesium.BoxGeometry({
dimensions: new Cesium.Cartesian3(400000., 300000., 500000.)
}),
modelMatrix: Cesium.Matrix4.multiplyByTranslation(
Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)),
new Cesium.Cartesian3(., ., 250000.),
new Cesium.Matrix4()
),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED)
}
}),
appearance: new Cesium.PerInstanceColorAppearance()
});
viewer.scene.primitives.add(primitive);
```
希望对你有帮助!
阅读全文