I want to draw a line with gl.line instead of drawing a line model or signed distance field(SDF)。this is my code ,and i can‘t find the line in the 3d scene,i do not know how to do that。
import * as Cesium from "../Source/Cesium.js";
import "cesium/Widgets/widgets.css";
import "../src/css/main.css"
// Your access token can be found at: https://cesium.com/ion/tokens.
// This is the default access token
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWE1OWUxNy1mMWZiLTQzYjYtYTQ0OS1kMWFjYmFkNjc5YzciLCJpZCI6NTc3MzMsImlhdCI6MTYyNzg0NTE4Mn0.XcKpgANiY19MC4bdFUXMVEBToBmqS8kuYpUlxJHYZxk';
// Initialize the Cesium Viewer in the HTML element with the `cesiumContainer` ID.
const viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: Cesium.createWorldTerrain()
});
var p1 =Cesium.Cartesian3.fromDegrees(-180.0, 25.0,10000);
var p2 =Cesium.Cartesian3.fromDegrees(0.0, 125.0,10000);
var p3 =Cesium.Cartesian3.fromDegrees(162.0, 125.0,10000);
var _p=[
p1.x,p1.y,p1.z,p2.x,p2.y,p2.z,p3.x,p3.y,p3.z,
];
var positions = new Float64Array(_p);
var geometry = new Cesium.Geometry({
attributes : {
position : new Cesium.GeometryAttribute({
componentDatatype : Cesium.ComponentDatatype.DOUBLE,
componentsPerAttribute : 3,
values : positions, color : new Cesium.ColorGeometryInstanceAttribute(Cesium.Color.red)
})
},
indices : new Uint16Array([0, 1, 1, 2, 2, 0]),
primitiveType : Cesium.PrimitiveType.LINES,
boundingSphere : Cesium.BoundingSphere.fromVertices(positions)
});
var instance = new Cesium.GeometryInstance({
geometry :geometry,
attributes : {
color : new Cesium.ColorGeometryInstanceAttribute(Cesium.Color.red)
}
});
viewer.scene.primitives.add(new Cesium.Primitive({
geometryInstances : instance,
asynchronous:false
}));
// Add Cesium OSM Buildings, a global 3D buildings layer.
//viewer.scene.primitives.add(Cesium.createOsmBuildings());
// Fly the camera to San Francisco at the given longitude, latitude, and height.
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(-80.0, 25.0,10000),
orientation : {
heading : Cesium.Math.toRadians(0.0),
pitch : Cesium.Math.toRadians(-15.0),
}
});