/* eslint-disable */
//if (!Detector.webgl)
// Detector.addGetWebGLMessage();
var camera, controls, scene, renderer;
init();
//render(); // remove when using next line for animation loop (requestAnimationFrame)
animate();
function init() {
scene = new THREE.Scene();
scene.background = new THREE.Color(0);
renderer = new THREE.WebGLRenderer({antialias:true});
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
var container = document.getElementById("container");
container.appendChild(renderer.domElement);
camera = new THREE.PerspectiveCamera(60,window.innerWidth / window.innerHeight,1,1000);
camera.position.set(-0, 0, 360);
// controls
controls = new THREE.OrbitControls(camera,renderer.domElement);
controls.enableDamping = true;
// an animation loop is required when either damping or auto-rotation are enabled
controls.dampingFactor = 0.25;
controls.screenSpacePanning = false;
controls.minDistance = 100;
controls.maxDistance = 500;
controls.maxPolarAngle = 3.14/2;//Math.PI / 2;
// world
//Load the data.
new THREE.FileLoader().load("https://www.brainsen.com/planimetrie-json.txt", function(data) {
data = JSON.parse(data);
var vi = 0;
var points = new Array(data.geometry.length * 2);
for (var i = 0; i < data.geometry.length; i++) {
var ln = data.geometry[i];
points[i * 2] = new THREE.Vector3(ln[0],ln[1],0);
points[(i * 2) + 1] = new THREE.Vector3(ln[2],ln[3],0);
}
var ngeom = new THREE.BufferGeometry().setFromPoints(points);
var nmesh = new THREE.LineSegments(ngeom,new THREE.LineBasicMaterial({
color:0x10ff10,
opacity:0.02,
blending:THREE.AdditiveBlending,
transparent:true}));
//Compute the bounding box and center the model on the bounding box center.
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.