how to add a Irregular body if i know the face
how to create a mesh by the points in cesium
// First prepare position, normal, uv buffers.
let position = new Cesium.GeometryAttribute({
componentDatatype: Cesium.ComponentDatatype.DOUBLE,
componentsPerAttribute: 3,
values: new Float64Array(positionBuffer)
});
let normal = new Cesium.GeometryAttribute({
componentDatatype: Cesium.ComponentDatatype.FLOAT,
componentsPerAttribute: 3,
values: new Float32Array(normalBufffer)
});
let st = new Cesium.GeometryAttribute({
componentDatatype: Cesium.ComponentDatatype.FLOAT,
componentsPerAttribute: 2,
values: new Float32Array(uvBuffer)
});
// prepare material
let customPrimitive = new Cesium.Primitive({
geometryInstances : new Cesium.GeometryInstance({
geometry: new Cesium.Geometry({
attributes: {
position: position,
normal: normal,
st: st
},
indices : new Uint16Array(sphereGeometry.index),
primitiveType: Cesium.PrimitiveType.TRIANGLES,
boundingSphere: Cesium.BoundingSphere.fromVertices(positionBuffer)
}),
}),
appearance: new Cesium.MaterialAppearance({
material: material,
closed: true
}),
asynchronous: false
});
viewer.scene.primitives.add(spherePrimitive);