I use Vue and cesium to create an app, which is rendered normally when I open it for the first time; However, switching routes will result in a rendering error.
I realized that the problem might be caused by this function.When I annotate this function, Everything is back to normal.
async function loadModel() {
const airplaneUri = await Cesium.IonResource.fromAssetId(545921);
const airplaneEntity = viewer.entities.add({
availability: new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({ start: start, stop: stop })]),
position: positionProperty,
model: { uri: airplaneUri, minimumPixelSize: 128, },
orientation: new Cesium.VelocityOrientationProperty(positionProperty),
path: new Cesium.PathGraphics({ width: 1 }),
});
viewer.trackedEntity = airplaneEntity;
}
loadModel();
This is the call stack of the problem
DeveloperError: attribute must have a vertexBuffer or a value.
Error
at new DeveloperError (webpack-internal:///./node_modules/cesium/Source/Core/DeveloperError.js:43:11)
at addAttribute (webpack-internal:///./node_modules/cesium/Source/Renderer/VertexArray.js:39:11)
at new VertexArray (webpack-internal:///./node_modules/cesium/Source/Renderer/VertexArray.js:300:5)
at eval (webpack-internal:///./node_modules/cesium/Source/Scene/Model.js:3089:68)
at Function.ForEach.meshPrimitive (webpack-internal:///./node_modules/cesium/Source/Scene/GltfPipeline/ForEach.js:225:21)
at eval (webpack-internal:///./node_modules/cesium/Source/Scene/Model.js:3014:71)
at Function.ForEach.object (webpack-internal:///./node_modules/cesium/Source/Scene/GltfPipeline/ForEach.js:45:21)
at Function.ForEach.topLevel (webpack-internal:///./node_modules/cesium/Source/Scene/GltfPipeline/ForEach.js:66:18)
at Function.ForEach.mesh (webpack-internal:///./node_modules/cesium/Source/Scene/GltfPipeline/ForEach.js:214:18)
at createVertexArrays (webpack-internal:///./node_modules/cesium/Source/Scene/Model.js:3013:69)```
This is due to the problem caused by loading the model from the cesium console. When I load the model in the local static folder, everything is normal. I hope it can help people who encounter the same problem.