All Projects → maptalks → Maptalks.three

maptalks / Maptalks.three

Licence: mit
A maptalks Layer to render with THREE.js.

Programming Languages

typescript
32286 projects

Labels

Projects that are alternatives of or similar to Maptalks.three

Three Projected Material
📽 Three.js Material which lets you do Texture Projection on a 3d Model
Stars: ✭ 177 (-21.68%)
Mutual labels:  threejs
Demos
One repo to rule them all.
Stars: ✭ 204 (-9.73%)
Mutual labels:  threejs
Blueprint Js
The Javascript es6 version of the original furnishup/blueprint3d. Need some royalty free low poly models for the inventory. Can someone help me with this?
Stars: ✭ 208 (-7.96%)
Mutual labels:  threejs
Robot Gui
A three.js based 3D robot interface.
Stars: ✭ 181 (-19.91%)
Mutual labels:  threejs
Droneworld
droneWorld: a 3D world map and a three.js playground
Stars: ✭ 197 (-12.83%)
Mutual labels:  threejs
Three.interaction.js
three.js interaction toolkit, help you built an interaction event-system for three.js, binding interaction event like browser-dom
Stars: ✭ 206 (-8.85%)
Mutual labels:  threejs
Pipes
💿 Classic 3D Pipes screensaver remake (web-based)
Stars: ✭ 176 (-22.12%)
Mutual labels:  threejs
Three Seed
A Three.js starter project with ES6 and Webpack
Stars: ✭ 213 (-5.75%)
Mutual labels:  threejs
Node Occ
build BREP Solids with OpenCascade and NodeJS - 3D Modeling
Stars: ✭ 202 (-10.62%)
Mutual labels:  threejs
Hdri To Cubemap
Image converter from spherical map to cubemap
Stars: ✭ 207 (-8.41%)
Mutual labels:  threejs
Aframe
🅰️ web framework for building virtual reality experiences.
Stars: ✭ 13,428 (+5841.59%)
Mutual labels:  threejs
React Three Next
React Three Fiber, Nextjs, Tailwind starter
Stars: ✭ 195 (-13.72%)
Mutual labels:  threejs
Forgejs
ForgeJS is a javascript framework that unleashes immersive WebVR experiences.
Stars: ✭ 207 (-8.41%)
Mutual labels:  threejs
Ar.js
Image tracking, Location Based AR, Marker tracking. All on the Web.
Stars: ✭ 3,048 (+1248.67%)
Mutual labels:  threejs
Three.vrcontroller
Support hand controllers for Oculus, Vive, Windows Mixed Reality, Daydream, GearVR, and more by adding VRController to your existing Three.js-based WebVR project.
Stars: ✭ 213 (-5.75%)
Mutual labels:  threejs
Aframe Effects
A VR Ready Post processing framework for Three.js and/or A-Frame
Stars: ✭ 176 (-22.12%)
Mutual labels:  threejs
Magicshader
🔮 Tiny helper for three.js to debug and write shaders
Stars: ✭ 205 (-9.29%)
Mutual labels:  threejs
Three Text2d
Render texture from canvas into THREE's Mesh or Sprite.
Stars: ✭ 223 (-1.33%)
Mutual labels:  threejs
Ifc.js
Ifc viewer for client applications.
Stars: ✭ 211 (-6.64%)
Mutual labels:  threejs
Pathfinding Visualizer Threejs
A visualizer for pathfinding algorithms in 3D with maze generation, first-person view and device camera input.
Stars: ✭ 209 (-7.52%)
Mutual labels:  threejs

maptalks.three

CircleCI NPM Version

A maptalks Layer to render with THREE.js

screenshot

Examples

Install

  • Install with npm: npm install maptalks.three.
  • Download from dist directory.
  • Use unpkg CDN: https://unpkg.com/maptalks.three/dist/maptalks.three.min.js

Migration from <=v0.5.x to v0.6.0

  • Re-implementated locateCamera, sync with map's projMatrix and viewMatrix.
  • Model's z position is reversed from v0.5.0. So if you have models rendered with v0.5.x, rotation needs to be updated.
  • For THREE <= 0.94, material's side need to set to THREE.BackSide or THREE.DoubleSide to render correctly
    • THREE >= 0.95 doesn't need, maybe due to #14379
  • Add support for THREE >= 0.93
  • Add support for GroupGLLayer

Usage

As a plugin, maptalks.three must be loaded after maptalks.js and THREE.js in browsers.

<script type="text/javascript" src="https://unpkg.com/[email protected]/build/three.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/maptalks/dist/maptalks.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/maptalks.three/dist/maptalks.three.js"></script>
<script>
var threeLayer = new maptalks.ThreeLayer('t');
threeLayer.prepareToDraw = function (gl, scene, camera) {
    var light = new THREE.DirectionalLight(0xffffff);
    light.position.set(0, -10, -10).normalize();
    scene.add(light);
    var me = this;
    countries.features.forEach(function (g) {
        var num = g.properties.population;
        var color = getColor(num);

        var m = new THREE.MeshPhongMaterial({color: color, opacity : 0.7});

        var mesh = me.toExtrudeMesh(maptalks.GeoJSON.toGeometry(g), num / 4E2, m);
        if (Array.isArray(mesh)) {
            scene.add.apply(scene, mesh);
        } else {
            scene.add(mesh);
        }
    });
};

map.addLayer(threeLayer);
</script>

With ES Modules:

import * as THREE from 'three';
import * as maptalks from 'maptalks';
import { ThreeLayer } from 'maptalks.three';

const map = new maptalks.Map('map', { /* options */ });

const threeLayer = new ThreeLayer('t');
threeLayer.prepareToDraw = function (gl, scene, camera) {
    const light = new THREE.DirectionalLight(0xffffff);
    light.position.set(0, -10, -10).normalize();
    scene.add(light);
    //...
};

threeLayer.addTo(map);

Supported Browsers

IE 11, Chrome, Firefox, other modern and mobile browsers that support WebGL;

API Reference

ThreeLayer is a subclass of maptalks.CanvasLayer and inherits all the methods of its parent.

API

API中文

Constructor

new maptalks.ThreeLayer(id, options)
  • id String layer id
  • options Object options
    • glOptions Object options when creating webgl context, null by default
    • doubleBuffer Boolean whether the layer canvas is painted with double buffer, true by default
    • Other options defined in maptalks.CanvasLayer

Contributing

We welcome any kind of contributions including issue reportings, pull requests, documentation corrections, feature requests and any other helps.

Develop

The only source file is index.js.

It is written in ES6, transpiled by babel and tested with mocha and expect.js.

Scripts

  • Install dependencies
$ npm install
  • Watch source changes and generate runnable bundle repeatedly
$ npm run dev
  • Package and generate minified bundles to dist directory
$ npm run build
  • Lint
$ npm run lint

Publication

npm version ${version}
npm publish
npm push master ${version}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].