首页 / 浏览问题 / WebGIS / 问题详情
想请教一下大佬,想给primitive贴上图片纹理
4EXP 2021年04月13日

我给这个primitive的圆柱贴图,结果是白模。为什么会这样呢?谢谢

1个回答

您好,您怎么设置贴图的,是用material吗

比如ellipse.material = '../images/cats.jpg';

或者

ellipse.material = new Cesium.ImageMaterialProperty({ image:'../images/cats.jpg', color: Cesium.Color.BLUE, repeat : new Cesium.Cartesian2(4, 4) });

注意图片路径是否正确
1,545EXP 2021年04月13日
appearance: new Cesium.MaterialAppearance({
                        material: new Cesium.Material({
                            fabric: {
                                type: 'Image',
                                uniforms: {
                                    image: './data/cylinder3.png',
                                },
                            }
                        }),

您好,是这么加的。
var center = Cesium.Cartesian3.fromDegrees(0,0)
  var aa=viewer.scene.primitives.add(
        new Cesium.Primitive({
            geometryInstances: new Cesium.GeometryInstance({
                geometry: new Cesium.EllipseGeometry({
                    center: center,//心中位置
                    semiMajorAxis: 100000,//椭圆长半轴
                    semiMinorAxis: 50000,//椭圆短半轴
                    height: 100,//    离椭球体的高度
                    extrudedHeight: 100000// 拉伸高度
                }),
                id: "EllipseGeometry"
            }),
            appearance: new Cesium.MaterialAppearance({
                aboveGround: false,
                material: new Cesium.Material({
                            fabric: {
                                type: 'Image',
                                uniforms: {
                                    image: './images/location4.png'
                                },
                            }
            })
        })
        })
   )

您这样写看看
...