我决定不从Babylonjs 基础来讲了 直接整合cesium与babylonjs可视化来讲
我整合一个类库 后续不断更新中
- npm i @haibalai/cesium-babylonjs
初始化cesium-babylonjs 类库, viewer 是 Cesium 的 viewer对象
- import { BabylonMapManager } from "@haibalai/cesium-babylonjs";
- BabylonMapManager.init(viewer);
添加正方体
- import { BabylonMapManager } from "@haibalai/cesium-babylonjs";
- let scene = BabylonMapManager.getScene(viewer);
- const material = new BABYLON.StandardMaterial("material", scene);
- material.diffuseColor = new BABYLON.Color3(0, 1, 0);
- material.backFaceCulling = false;
- const box = BABYLON.MeshBuilder.CreateBox("box", {
- sideOrientation:2,
- size: 100
- }, scene);
- BabylonMapManager.addToMap(box,[113.87629508972168, 22.544824222364753, 100]);
- const roof = BABYLON.MeshBuilder.CreateCylinder("roof", {
- sideOrientation:2,
Cesium 与 Babylon.js 可视化 构建房子 - 小专栏
标签:material,viewer,babylonjs,BabylonMapManager,js,cesium,Cesium,Babylon From: https://www.cnblogs.com/haibalai/p/17217349.html