1
0
forked from MTSR/mapserver

working 3d view

This commit is contained in:
Thomas Rudin 2020-02-14 19:53:32 +01:00
parent 73c128a577
commit 11347a270d

View File

@ -29,7 +29,7 @@ function getMaterial(nodeName){
} }
function isNodeHidden(mapblock,x,y,z){ function isNodeHidden(mapblock,x,y,z){
if (x==0 || x>=15 || y==0 || y>=15 || z==0 || z>=15){ if (x<=1 || x>=14 || y<=1 || y>=14 || z<=1 || z>=14){
// not sure, may be visible // not sure, may be visible
return false; return false;
} }
@ -75,9 +75,9 @@ function drawMapblock(posx,posy,posz){
continue; continue;
} }
var i = getNodePos(x,y,z);
var contentId = mapblock.contentid[i]; var contentId = mapblock.contentid[i];
var nodeName = mapblock.blockmapping[contentId]; var nodeName = mapblock.blockmapping[contentId];
var i = getNodePos(x,y,z);
var geo = geometry.clone(); var geo = geometry.clone();
var matrix = new THREE.Matrix4() var matrix = new THREE.Matrix4()
@ -119,7 +119,7 @@ function init() {
scene = new THREE.Scene(); scene = new THREE.Scene();
var min = -3, max = 3; var min = -7, max = 7;
var x = min, y = -1, z = min; var x = min, y = -1, z = min;
function increment(){ function increment(){
@ -143,7 +143,7 @@ function init() {
.then(function(){ .then(function(){
render(); render();
increment(); increment();
setTimeout(drawLoop, 100); setTimeout(drawLoop, 50);
}); });
}; };
@ -158,7 +158,7 @@ function init() {
document.body.appendChild( renderer.domElement ); document.body.appendChild( renderer.domElement );
controls = new THREE.TrackballControls( camera, renderer.domElement ); controls = new THREE.TrackballControls( camera, renderer.domElement );
controls.rotateSpeed = 1.0; controls.rotateSpeed = 2.0;
controls.zoomSpeed = 1.2; controls.zoomSpeed = 1.2;
controls.panSpeed = 0.8; controls.panSpeed = 0.8;