diff --git a/.npmrc b/.npmrc index 7549542..8b13789 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -registry=https://registry.npmmirror.com + diff --git a/README.md b/README.md index 3ea573d..40d9896 100644 --- a/README.md +++ b/README.md @@ -1,75 +1,31 @@ # maplibre-three-plugin + `maplibre-three-plugin` is a bridge plugin that cleverly connects [MapLibre GL JS](https://maplibre.org/maplibre-gl-js/docs/) with [Three.js](https://threejs.org/), enabling developers to implement 3D rendering and animation on maps. -## Install +## Install ```shell -npm install @dvgis/maplibre-three-plugin +npm install @dvgis/maplibre-three-plugin ---------------------------------------- -yarn add @dvgis/maplibre-three-plugin` +yarn add @dvgis/maplibre-three-plugin ``` -## Start - +## Quickly Start + `maplibre-three-plugin` depends on three, please make sure three is installed before using it. ```javascript - import maplibregl from 'maplibre-gl'; - import 'maplibre-gl/dist/maplibre-gl.css'; - import {MapScene} from '@dvgis/maplibre-three-plugin' - - const map = new maplibregl.Map({ - container: 'map', // container id - style: 'https://demotiles.maplibre.org/style.json', // style URL - center: [0, 0], // starting position [lng, lat] - zoom: 1 // starting zoom - }); - const mapScene = new MapScene(map) -``` - -## MapScene - -### constructor(map,[options]) - -- params - - `{maplibregl.Map} map ` : map instance - - `{Object} options ` : config - -```js -{ - scene: null, - camera:null, - renderer: null, - preserveDrawingBuffer: false, - renderLoop: (ins) =>{} -} - +import maplibregl from 'maplibre-gl' +import 'maplibre-gl/dist/maplibre-gl.css' +import { MapScene } from '@dvgis/maplibre-three-plugin' + +const map = new maplibregl.Map({ + container: 'map', // container id + style: 'https://demotiles.maplibre.org/style.json', // style URL + center: [0, 0], // starting position [lng, lat] + zoom: 1, // starting zoom +}) +const mapScene = new MapScene(map) ``` -### properties - -- `{maplibregl.Map} map` -- `{HttmElement} canvas` -- `{THREE.Scene} scene` -- `{THREE.Camera} camera` -- `{THREE.WebGLRenderer} renderer` -- `{THREE.Group} world` - -### methods - -- projectedUnitsPerMeter(lat) - -- lngLatToVector3(lng,lat,alt) - -- vector3ToLngLat(v3) - - - - - - - - - - - +## Examples diff --git a/examples/box.html b/examples/box.html deleted file mode 100644 index e69de29..0000000 diff --git a/examples/data/GroundVehicle.glb b/examples/data/GroundVehicle.glb deleted file mode 100644 index bef1899..0000000 Binary files a/examples/data/GroundVehicle.glb and /dev/null differ diff --git a/examples/fbx.html b/examples/fbx.html deleted file mode 100644 index e69de29..0000000 diff --git a/examples/glb.html b/examples/glb.html deleted file mode 100644 index 97054eb..0000000 --- a/examples/glb.html +++ /dev/null @@ -1,76 +0,0 @@ - - -
- - - -