想请教一下大佬,想给primitive贴上图片纹理

0 投票

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

4月 13 分类:  169次浏览 | 用户: kkhai (4 分)

1个回答

0 投票
您好,您怎么设置贴图的,是用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) });

注意图片路径是否正确
4月 13 用户: KeineAhnung 名扬四海 (1,545 分)
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'
                                },
                            }
            })
        })
        })
   )

您这样写看看
...