当前位置: 首页 > article >正文

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

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();






http://www.kler.cn/a/565008.html

相关文章:

  • AppInventor2 vs Android Studio
  • 基于Python socket库构建的基于 P2P 的文件共享系统示例
  • STM32 物联网智能家居 (七) 设备子系统--风扇控制
  • dockerfile基于alpine构建haproxy
  • 突破加速度计的精度与量程瓶颈:HEROS-GAN技术
  • drupal可以自动将测试环境的网页部署到生产环境吗
  • 蓝桥杯 Java B 组之最短路径算法(Dijkstra、Floyd-Warshall)
  • 【vue3+highCharts】图表及字体大小自适应
  • 【动态规划篇】正则表达式与通配符:开启代码匹配的赛博奇幻之旅
  • 大数据SQL调优专题——底层调优
  • 详解linuxC编程下的同步原语
  • Text2SQL数据集和技术方案整理
  • Python基于机器学习的微博舆情情感分析系统,微博评论情感分析可视化系统(全新升级)
  • Python----数据分析(Numpy四:广播机制,数组的运算,统计计算,where函数)
  • Lumoz Chain正式上线:AI 时代的新算力破局者
  • Qt 中实现链表
  • 【EXE/DLL文件的分析方法、工具环境搭建及具体分析步骤的详细指南】
  • DeepSeek开源技术全景解析:从硬件榨取到AI民主化革命
  • wav格式的音频压缩,WAV 转 MP3 VBR 体积缩减比为 13.5%、多个 MP3 格式音频合并为一个、文件夹存在则删除重建,不存在则直接建立
  • Spring Boot 3.x 引入springdoc-openapi (内置Swagger UI、webmvc-api)