# threebox
A three.js plugin for Mapbox GL JS, using the custom layer feature. Provides convenient methods to manage objects in lnglat coordinates, and to synchronize the map and scene cameras.
## File
[Click here to view the document](https://github.com/peterqliu/threebox)
## optimization
More strict handwriting mode is adopted to solve the problem of compiling luixus
## It might help you
```
import mapboxgl from 'mapbox-gl'
import * as THREE from 'three'
import {GLTFLoader} from 'three/examples/jsm/loaders/GLTFLoader';
import {DRACOLoader} from 'three/examples/jsm/loaders/DRACOLoader';
import {Threebox} from 'threebox-map';
/*Load gltfdraco model*/
let data = {
id: "",
url: '',
origin: []
};
let _this = this;
let gltfLoader = new GLTFLoader();
let dracoLoader = new DRACOLoader();
let tb, cube;
let layer = {
id: data.id,
type: 'custom',
onAdd: function (map, mbxContext) {
tb = new Threebox(
map,
mbxContext,
{defaultLights: true}
);
let pointLight = new THREE.PointLight('red', 1000, 5000);
tb.add(pointLight);
dracoLoader.setDecoderPath('static/draco/');
gltfLoader.setDRACOLoader(dracoLoader);
gltfLoader.load(data.url, (gltf => {
cube = tb.Object3D({obj: gltf.scene});
cube.set({rotation: {x: 90, y: -180, z: 0}});
cube.setCoords(data.origin);
tb.add(cube);
}));
},
render: function (gl, matrix) {
tb.update();
}
};
_this.map.on('style.load', function () {
_this.map.addLayer(layer, 'country-label');
});
```
没有合适的资源?快使用搜索试试~ 我知道了~
threebox-map:使用自定义图层功能的Mapbox GL JS的three.js插件。 提供方便的方法来管理线性坐标中的...

共64个文件
js:35个
html:11个
png:6个


三箱 使用自定义图层功能的Mapbox GL JS的three.js插件。 提供方便的方法来管理线性坐标中的对象,以及同步地图和场景摄像机。 文件 优化 采用更严格的手写方式解决了luixus的编译问题 可能对你有帮助 import mapboxgl from 'mapbox-gl' import * as THREE from 'three' import {GLTFLoader} from 'three/examples/jsm/loaders/GLTFLoader'; import {DRACOLoader} from 'three/examples/jsm/loaders/DRACOLoader'; import {Threebox} from 'threebox-map'; /*Load gltfdraco model*/ let data = { id: "",
资源详情
资源评论
资源推荐
收起资源包目录


















































































共 64 条
- 1


















我是卖报的小砖家
- 粉丝: 14
- 资源: 4620

上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
安全验证
文档复制为VIP权益,开通VIP直接复制

评论1