WME/aufgabe5/public/assets/js/webgl.js

67 lines
1.7 KiB
JavaScript
Raw Normal View History

2019-01-11 11:31:36 +00:00
let tableData_global; // fetched date
// true/false-map für properties
2019-01-09 11:25:28 +00:00
2019-01-11 11:31:36 +00:00
const doFetchCountries = () => {
$.ajax({ url: "/items" }).done((data) => {
if (data instanceof Array) tableData_global = data;
else {
tableData_global = [];
tableData_global.push(data);
}
});
};
window.onload = () => {
doFetchCountries();
setup();
};
/*
2019-01-09 11:25:28 +00:00
function three() {
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1,
1000);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
var geometry = new THREE.BoxGeometry(1, 1, 1);
var material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
var cube = new THREE.Mesh(geometry, material);
scene.add(cube);
camera.position.z = 5;
var animate = function () {
requestAnimationFrame(animate);
cube.rotation.x += 0.01;
cube.rotation.y += 0.01;
renderer.render(scene, camera);
};
animate();
}
2019-01-11 11:31:36 +00:00
*/
2019-01-09 11:25:28 +00:00
2019-01-11 11:31:36 +00:00
let myMap;
let canvas;
let mappa;
2019-01-09 11:25:28 +00:00
2019-01-11 11:31:36 +00:00
// Lets put all our map options in a single object
const options = {
lat: 0,
lng: 0,
zoom: 4,
style: 'mapbox://styles/mapbox/traffic-night-v2'
}
2019-01-09 11:25:28 +00:00
2019-01-11 11:31:36 +00:00
function setup() {
const key = 'pk.eyJ1IjoicmljYXJkb2xhbmduZXIiLCJhIjoiY2pxano2enh2MG1qazN4bm5lajIzeDl3eiJ9.wK0MtuxLgJxDcGUksKMeKg';
mappa = new Mappa('MapboxGL', key);
canvas = createCanvas(window.innerWidth, window.innerHeight);
// background(100); let's uncomment this, we don't need it for now
2019-01-09 11:25:28 +00:00
2019-01-11 11:31:36 +00:00
// Create a tile map with the options declared
2019-01-09 11:25:28 +00:00
myMap = mappa.tileMap(options);
myMap.overlay(canvas);
}
2019-01-11 11:31:36 +00:00
function draw() {
}