diff --git a/panther.js b/panther.js index bb6957623e38d58934e8afcf08d522de475120a0..980f280e71e2f5f399baf88a83173e99c237ccd0 100644 --- a/panther.js +++ b/panther.js @@ -95,7 +95,7 @@ } const gui = new GUI(); gui.add(params, 'machine', conf.machineList).onChange(function() {toggleMachine(params.machine);}); - params.mode = document.location.search.indexOf('fast')>-1? 'fast': document.location.search.indexOf('premium')>-1? 'premium': 'plus'; + params.mode = document.location.search.indexOf('fast')>-1? 'fast': document.location.search.indexOf('premium')>-1? 'premium': document.location.search.indexOf('plus')>-1? 'plus': 'normal'; gui.add(params, 'mode', conf.modes).onChange(function() {toggleParam('mode', params.mode);}); params.vlv = document.location.search.indexOf('vlv')>-1; gui.add(params, 'vlv').name('vlv & bst').onChange(function() {toggleParam('vlv');}); @@ -104,6 +104,8 @@ gui.title('PAnTHer - controls'); gui.add(params, 'search'); // .onKeyup(function() {console.log('search');}); gui.addColor(params, 'backgroundColor').onChange(function() {toggleParam('backgroundColor');}); + params.far = 120; + gui.add(params, 'far', 50, 400).onChange(function() {setFar(params.far);}); const debugcamera = document.location.search.indexOf('debugcamera')>-1; if (debugcamera) $('body').append('<div class="debug" style="top: 0; position: fixed;"> x: <input size="5" id="x"/>, y: <input size="5" id="y"/>, z: <input size="5" id="z"/>, cx: <input size="5" id="cx"/>, cy: <input size="5" id="cy"/>, cz: <input size="5" id="cz"/>'); const highlight = document.location.search.indexOf('highlight=')==-1? []: document.location.search.split('highlight=')[1].split('&')[0].split(','); @@ -861,7 +863,12 @@ camera.position.set(cameraPos[0]*params.highlightScale, cameraPos[1]*params.highlightScale, cameraPos[2]*params.highlightScale); camera.rotation.set(cameraPos[3],cameraPos[4],cameraPos[5]); } - + function setFar(far) { + console.log('setFar', far); + camera.far = far*1000; + camera.updateProjectionMatrix(); + } +window.setFar = setFar; function init() { scene = new THREE.Scene(); scene.background = new THREE.Color(document.location.search.indexOf('background=')>-1? document.location.search.split('background=')[1].split('&')[0]: 0x777777); @@ -873,7 +880,7 @@ renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); const fov = document.location.search.indexOf('fov=')>-1? document.location.search.split('fov=')[1].split('&')[0]-0: 45; - camera = new THREE.PerspectiveCamera(fov, window.innerWidth / window.innerHeight, 0.001, 1000000); + camera = new THREE.PerspectiveCamera(fov, window.innerWidth / window.innerHeight, 0.001, fast!==false? 1000000: 120000); // controls if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) controls = new MapControls(camera, renderer.domElement); else { @@ -1021,9 +1028,9 @@ } if (search.indexOf("highlight=")>-1) {for (let j=search.length-1; j>=0; j--) if (search[j].indexOf("highlight")>-1) search.splice(j, 1);} if (name=='mode') { - if (search.indexOf(value)>-1 || (value=='plus' && search.indexOf('fast')==-1 && search.indexOf('premium')==-1)) return; - search = search.filter(item => item !== 'fast' && item !== 'premium' && item !== 'mode'); - if (value!='plus') search.push(value); + if (search.indexOf(value)>-1 || (value=='normal' && search.indexOf('fast')==-1 && search.indexOf('premium')==-1 && search.indexOf('plus')==-1)) return; + search = search.filter(item => item !== 'fast' && item !== 'plus' && item !== 'premium' && item !== 'mode'); + if (value!='normal') search.push(value); } const res = search.join('&'); document.location = document.location.href.split('?')[0]+(res.length? '?'+res: '');