当我改成动态渲染时会报这个错:The appearance requires vertex shader attribute input ‘prevPosition2DHigh’, which was not computed as part of the Geometry. Use the appearance’s vertexFormat property when constructing the geometry.大神,帮帮我吧
function creatgxPolylinePrimit(positions, linewidth, linecolor, img, speed, isClose) {
var cvs = img;
var pl = new Cesium.PolylineVolumeGeometry({
polylinePositions: positions,
shapePositions: computeCircle(linewidth),
vertexFormat: Cesium.VertexFormat.POSITION_ONLY
});
var ins = new Cesium.GeometryInstance({
geometry: Cesium.PolylineVolumeGeometry.createGeometry(pl),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED),
}
})
// var ins = GeometryIns(pl);
var linesInstances = [];
linesInstances.push(ins);
var cesiumColor = Cesium.Color.fromCssColorString(linecolor);
var appc = new Cesium.PolylineMaterialAppearance({
material: new Cesium.Material({
fabric: {
uniforms: {
image: cvs,
animationSpeed: speed,
color: cesiumColor
},
source: “czm_material czm_getMaterial(czm_materialInput materialInput) { \n\
czm_material material = czm_getDefaultMaterial(materialInput);\n\
vec2 st = materialInput.st;\n\
float time = czm_frameNumber * animationSpeed;\n\
vec4 colorImage = texture2D(image,vec2(fract(st.s – time), st.t));\n\
material.alpha = colorImage.a;\n\
material.diffuse = colorImage.rgb;\n\
return material;\n\
} \n”,
// aboveGround: true,
},
}),
})
// var curPrimitive = primitv(linesInstances, appc);
var curPrimitive = new Cesium.Primitive({
geometryInstances: linesInstances,
appearance: appc,
asynchronous: false
});
curPrimitive = window.CesiumViewer.scene.primitives.add(curPrimitive);
return curPrimitive;
大神,请教一下,我照您的写primitive管线,报错 Cannot read property ‘attributes’ of undefined是怎么回事呀,谢谢呀
定位一下错误,或者看你的attributes是不是写错了啥的,你这么描述,不太知道是什么回事。。。
这个问题解决了吗?我也遇到了
当我改成动态渲染时会报这个错:The appearance requires vertex shader attribute input ‘prevPosition2DHigh’, which was not computed as part of the Geometry. Use the appearance’s vertexFormat property when constructing the geometry.大神,帮帮我吧
API里面查找一个vetexformat的类型,换成别的试一试
function creatgxPolylinePrimit(positions, linewidth, linecolor, img, speed, isClose) {
var cvs = img;
var pl = new Cesium.PolylineVolumeGeometry({
polylinePositions: positions,
shapePositions: computeCircle(linewidth),
vertexFormat: Cesium.VertexFormat.POSITION_ONLY
});
var ins = new Cesium.GeometryInstance({
geometry: Cesium.PolylineVolumeGeometry.createGeometry(pl),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED),
}
})
// var ins = GeometryIns(pl);
var linesInstances = [];
linesInstances.push(ins);
var cesiumColor = Cesium.Color.fromCssColorString(linecolor);
var appc = new Cesium.PolylineMaterialAppearance({
material: new Cesium.Material({
fabric: {
uniforms: {
image: cvs,
animationSpeed: speed,
color: cesiumColor
},
source: “czm_material czm_getMaterial(czm_materialInput materialInput) { \n\
czm_material material = czm_getDefaultMaterial(materialInput);\n\
vec2 st = materialInput.st;\n\
float time = czm_frameNumber * animationSpeed;\n\
vec4 colorImage = texture2D(image,vec2(fract(st.s – time), st.t));\n\
material.alpha = colorImage.a;\n\
material.diffuse = colorImage.rgb;\n\
return material;\n\
} \n”,
// aboveGround: true,
},
}),
})
// var curPrimitive = primitv(linesInstances, appc);
var curPrimitive = new Cesium.Primitive({
geometryInstances: linesInstances,
appearance: appc,
asynchronous: false
});
curPrimitive = window.CesiumViewer.scene.primitives.add(curPrimitive);
return curPrimitive;
}
我把所有的vertexFormat都试了一次,都报那个错,这是我的代码,大神麻烦您帮我看看吧,谢谢呀
cesium1.66 可以运行,代码和视频发你邮箱了
你好 同样的问题 请问你最后怎么解决的 感谢帮助!!
去掉vertexFormat就没报错了
你好,使用primitive 画几何体,按照你的参数
vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL
appearance : new Cesium.PerInstanceColorAppearance({
translucent : false,
closed : true
})
看起来还是没有立体感,这个要怎么解决呢