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();
相关推荐
未来之窗软件服务3 小时前
人体肢体工作识别-一步几个脚印从头设计数字生命——仙盟创梦IDE
3d·pygame·政务·仙盟创梦ide·人体识别
zhongqu_3dnest4 小时前
3DVR制作的工具或平台
3d·vr·数字孪生技术·vr制作·沉浸式体验
WenGyyyL1 天前
研读论文——《用于3D工业异常检测的自监督特征自适应》
人工智能·python·深度学习·机器学习·计算机视觉·3d
belldeep1 天前
python:trimesh 用于 STL 文件解析和 3D 操作
python·3d·stl
Leo.yuan1 天前
3D 数据可视化系统是什么?具体应用在哪方面?
大数据·数据库·3d·信息可视化·数据分析
Unity官方开发者社区1 天前
Android App View——团结引擎车机版实现安卓应用原生嵌入 3D 开发场景
android·3d·团结引擎1.5·团结引擎车机版
11054654011 天前
11、参数化三维产品设计组件 - /设计与仿真组件/parametric-3d-product-design
前端·3d
高德技术1 天前
IJCAI 2025 | 高德首个原生3D生成基座大模型「G3PT」重塑3D生成的未来
3d
球球和皮皮1 天前
Babylon.js学习之路《四、Babylon.js 中的相机(Camera)与视角控制》
javascript·3d·前端框架·babylon.js
像素工坊可视化2 天前
WebGL 开发的前沿探索:开启 3D 网页的新时代
3d·webgl