首页 / 浏览问题 / WebGIS / 问题详情
请教一下,超图是否支持FrustumGeometry构建方法,API手册中未找到
2EXP 2024年11月27日

构建一个视椎体

let frustum = new SuperMap3D.PerspectiveFrustum({
    // 查看的视场角,绕Z轴旋转,以弧度方式输入
    // fov: Cesium.Math.PI_OVER_THREE,
    fov: SuperMap3D.Math.toRadians(30),
    // 视锥体的宽度/高度
    aspectRatio: 200 / 300,
    // 近面距视点的距离
    near: 10,
    // 远面距视点的距离
    far: 100,
});
let instanceGeo = new SuperMap3D.GeometryInstance({
    geometry: new SuperMap3D.FrustumGeometry({
        frustum: frustum,
        origin: position,
        orientation: orientation,
        vertexFormat: SuperMap3D.VertexFormat.POSITION_ONLY,
    }),
    attributes: {
        color: SuperMap3D.ColorGeometryInstanceAttribute.fromColor(
            new SuperMap3D.Color(1.0, 0.0, 0.0, 0.5)
        ),
    },
});
let primitive = new SuperMap3D.Primitive({
    geometryInstances: instanceGeo,
    appearance: new SuperMap3D.PerInstanceColorAppearance({
        closed: true,
        flat: true,
    }),
    asynchronous: false,
});
viewer.scene.primitives.add(primitive);
...