I try to draw a primitive with texture appreance ,but encoutered error: "cannot read property 'center' of undefined ".
I check the cesium code ,it seems the center of boudingsphereCV, but Geometry class have no boudingsphereCV attribute.
code is below:
var geomRoad = new Cesium.Geometry({
attributes: {
position: new Cesium.GeometryAttribute({
componentDatatype: Cesium.ComponentDatatype.FLOAT,
componentsPerAttribute: 3,
values: positionsRoad
})
, st: new Cesium.GeometryAttribute({
componentDatatype: Cesium.ComponentDatatype.FLOAT,
componentsPerAttribute: 2,
values: UVsRoad
})
, normal: new Cesium.GeometryAttribute({
componentDatatype: Cesium.ComponentDatatype.FLOAT,
componentsPerAttribute: 3,
values: normalsRoad
})
},
indices: new Uint16Array([0, 1, 2, 1, 2, 3]),
primitiveType: Cesium.PrimitiveType.TRIANGLES,
boundingSphere: Cesium.BoundingSphere.fromVertices(positionsRoad)
});
var geoInstanceRoad = new Cesium.GeometryInstance({
geometry: geomRoad
, modelMatrix: Cesium.Transforms.eastNorthUpToFixedFrame(originPos)
//, attributes: {
// color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA)
//}
//id: 'top'
});
var matRoad = new Cesium.Material({
fabric: {
type: 'DiffuseMap',
uniforms: {
image: 'data/sketch.png'
}
}
});
var appearanceRoad = new Cesium.MaterialAppearance({
material: matRoad
});
viewer.scene.primitives.add(new Cesium.Primitive({
geometryInstances: geoInstanceRoad
, appearance: appearanceRoad
//,asynchronous:false
}));