From 13ef227e89c49f4a4ae40c524cad441971f84afc Mon Sep 17 00:00:00 2001 From: Pepper Date: Fri, 13 Feb 2015 04:01:18 -0500 Subject: calling it done for now --- js/3D_Landscape.js | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 4 deletions(-) (limited to 'js/3D_Landscape.js') diff --git a/js/3D_Landscape.js b/js/3D_Landscape.js index 1619de5..3c4eb08 100644 --- a/js/3D_Landscape.js +++ b/js/3D_Landscape.js @@ -43,7 +43,7 @@ function initGraphics(textureFile, heightmapFile, cb) { var img = new Image(); img.src = heightmapFile; img.onerror = function() { - alert("The following url did not work: "+heightmapFile.slice(14)); + alert("The following url did not work: \n"+heightmapFile.slice(15)); is_generating = false; toggle_background(); }; @@ -132,10 +132,65 @@ function render() { renderer.render(scene, camera); } +function init_controls2(){ + var listener = new window.keypress.Listener(); + listener.simple_combo("space", function() { + wf = !wf; + material.wireframe = wf; + }); + listener.simple_combo("shift up", function() { + mesh.rotation.x += 0.1; + }); + listener.simple_combo("shift down", function() { + mesh.rotation.x -= 0.1; + }); + listener.simple_combo("shift left", function() { + mesh.rotation.z += 0.1; + }); + listener.simple_combo("shift right", function() { + mesh.rotation.z -= 0.1; + }); + listener.simple_combo("pageup", function() { + mesh.position.z += 150; + }); + listener.simple_combo("pagedown", function() { + mesh.position.z -= 150; + }); + + listener.simple_combo("up",function() { + mesh.position.y += 150; + }); + + //Down + listener.simple_combo("down",function() { + mesh.position.y -= 150; + }); + + //Left + listener.simple_combo("left",function() { + mesh.position.x -= 150; + }); + + //Right + listener.simple_combo("right",function() { + mesh.position.x += 150; + }); + //Reset + listener.simple_combo("delete",function() { + mesh.position.x = pos_x; + mesh.position.y = pos_y; + mesh.position.z = pos_z; + mesh.rotation.x = rot_x; + mesh.rotation.y = rot_y; + mesh.rotation.z = rot_z; + + }); + +} + + function init_controls(){ //{{{init controls - //Controls - //Toggle wire-frame shortcut.add("Space",function() { @@ -206,5 +261,5 @@ function init_controls(){ } window.onload= function(e){ runWebGLSimulation(); - init_controls(); + init_controls2(); } -- cgit v1.2.3-70-g09d2