cesium 开发记录报错:DeveloperError: Appearance/Geometry mismatch.
The appearance requires vertex shader attribute input ‘compressedAttributes’, which was not computed as part of the Geometry. Use the appearance’s vertexFormat property when constructing the geometry.
DeveloperError: Appearance/Geometry mismatch.
The appearance requires vertex shader attribute input 'compressedAttributes',
which was not computed as part of the Geometry. Use the appearance's vertexFormat property when constructing the geometry.
cesium开发时,使用geometryInstances
添加实体时报错:
let geometry = Cesium.BoxOutlineGeometry.fromDimensions({
dimensions: this._dimensions
});
let modelMatrix = this.computerModelMatrix(this._centerPoint)
let instance = new Cesium.GeometryInstance({
geometry: geometry,
modelMatrix: Cesium.Matrix4.multiplyByTranslation(
modelMatrix,
offset,
new Cesium.Matrix4()),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA)
},
});
this._geometryInstances.push(instance)
scene.primitives.add(new Cesium.Primitive({
geometryInstances: this._geometryInstances,
appearance: new Cesium.PerInstanceColorAppearance( )
}));
错误大意是定点属性和材质的不匹配,后来才知道是因为BoxOutlineGeometry
不能使用光照,在appearance
中将flat
属性设为true
,即关闭关照,即可。
若是BoxGeometry
则无需关闭光照。
原官网该错误回答链接:Default PerInstanceColorAppearance doesn’t work with BoxOutlineGeometry