Geo3D城市引擎大规模建筑植被渲染

TypeScript 复制代码
import * as Geo3D from "../src";
import InitHelper from "./InitHelper";
//3D场景初始化
const sceneControl = InitHelper.init3D();
const container = document.querySelector("#map") as HTMLElement;
container && sceneControl.render(container);
const { scene, camera, renderer } = sceneControl;
const control = InitHelper._createControls(camera, container);
InitHelper.loadGltf(scene, 1);
renderer.shadowMap.type = PCFSoftShadowMap;
const light = InitHelper.addLight(scene, new Vector3(5000, 2000, 5000));
light.visible = true

//插件初始化
const centerGeo = new Vector3(116.185600, 39.896326, 0);
const imageryLayers = new Geo3D.ImageryLayers()
const tdtImageryLayer = new Geo3D.TDTImageryLayer({
    token: 'b832b97649334239ascbb0919148c548b669ba',
})
const tdtImageryLayer2 = new Geo3D.TDTImageryLayer({
    token: 'b832b9764939cbfeeb0919148c548b669ba',
    style: 'cva_w',
})
imageryLayers.add(tdtImageryLayer);
imageryLayers.add(tdtImageryLayer2);
const map = new Geo3D.Map({
    threeModule: {
        scene, camera, renderer, control
    },
    center: centerGeo,
    useEarth: false,
    imageryLayers: imageryLayers,
    // terrainLayer: new Geo3D.TerrainLayer({
    //     maxLevel: 14,
    //     url: globalConfig.terrain_beijing
    // })
})

map.addEventListener(Geo3D.MapEventType.ready, () => {
    const mask = document.getElementById('mask');
    mask!.style.display = 'none';
});

function getFormatExtent(coords) {
    const results: Geo3D.Point[] = [];
    for (let index = 0; index < coords.length; index++) {
        const pointCoord = coords[index];
        const coord3DXYZ = Geo3D.CoordUtil.LonLatTo3DXYZ(pointCoord[0], pointCoord[1], 0);
        results.push([coord3DXYZ.x, coord3DXYZ.z]);
    }
    return results;
}
const minlon1 = 116.182892;
const minlat1 = 39.894874;
const maxlon1 = 116.188174;
const maxlat1 = 39.897445;
const excludeCoords = [
    [minlon1, minlat1],
    [maxlon1, minlat1],
    [maxlon1, maxlat1],
    [minlon1, maxlat1],
    [minlon1, minlat1]
]
const excludeExtent = getFormatExtent(excludeCoords);
// 116.182944, 39.901406
const minlon = 116.162944;
const minlat = 39.881406;
const maxlon = 116.202944;
const maxlat = 39.921406;
const extentCoords = [
    [minlon, minlat],
    [maxlon, minlat],
    [maxlon, maxlat],
    [minlon, maxlat],
    [minlon, minlat]
]
const exttent = getFormatExtent(extentCoords);
const treePipline = new Geo3D.TreeManager.TreePipeline({
    imageryLayer: tdtImageryLayer,
    extent: exttent,
    exclude: excludeExtent,
    scene: scene,
    camera: camera
})
treePipline.add();

//
const buildingPipline = new Geo3D.BuildingPipline({
    pbfUrl: './static/shijingshan.bpf',
    scene: scene
})
buildingPipline.loadBuilding();
相关推荐
三维频道12 小时前
3C电子制造破局:高精度蓝光3D扫描仪在形位公差分析中的应用
3d·制造·3c电子制造·新拓三维·xtom·形位公差分析·蓝光3d扫描仪
AI前沿资讯1 天前
支持视频动作迁移的AI 3D平台有哪些?2026全维度测评
人工智能·3d
CG_MAGIC1 天前
幕后花絮:用Blender打造自己的建筑
3d·blender·贴图·uv·建模教程·渲云渲染
scott1985121 天前
3DGUT与3DGRT
3d
三维频道1 天前
压铸件尺寸检测与模具监测方案 / 3D Scanning for Die-casting QC & Mold Monitoring
人工智能·计算机视觉·3d·尺寸检测·xtom·压铸件·模具优化
aini_lovee2 天前
LIS3DH低功耗加速度传感器驱动程序
3d
三维频道2 天前
注塑件变形怎么调优?全尺寸3D检测如何助力精密注塑“减废增效”
3d·制造·智能制造·3d扫描仪·新拓三维·注塑模具质检·三维尺寸偏差分析
AI前沿资讯2 天前
2026年3D动画制作工具推荐:从传统工作流到AI一站式创作
人工智能·3d
bryant_meng2 天前
【3D】Stereo Matching learning notes
计算机视觉·3d·双目匹配
三维频道2 天前
工业级三维扫描实测:汽车灯具复杂结构件的全尺寸 3D 测量方案分析
java·人工智能·python·数码相机·3d·汽车·汽车轻量化制造