summaryrefslogtreecommitdiff
path: root/js/pb.js
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-02-12 19:33:18 -0800
committeryo mama <pepper@scannerjammer.com>2015-02-12 19:33:18 -0800
commit57ad852b6e7e337b7a86d2f85ac95b480898b057 (patch)
treee5192eb68c0e929ca276f821756b4952727c2787 /js/pb.js
parent7270ca308cad6dd87744472a8bfe37ab9d342bf0 (diff)
working
Diffstat (limited to 'js/pb.js')
-rw-r--r--js/pb.js25
1 files changed, 9 insertions, 16 deletions
diff --git a/js/pb.js b/js/pb.js
index 0e44fc8..b2babb5 100644
--- a/js/pb.js
+++ b/js/pb.js
@@ -1,4 +1,5 @@
var loadUrl = '/img/load';
+var textureURL, heightmapURL;
function getCookie(name) {
var arg = name + "=";
var alen = arg.length;
@@ -49,23 +50,15 @@ function saveScene(){
function loadNew() {
//Get values for url
- textureURL = document.getElementById("texture").value;
- heightmapURL = document.getElementById("heightmap").value;
+ textureURL = document.getElementById("texture").value.replace(/\s/,"");
+ heightmapURL = document.getElementById("heightmap").value.replace(/\s/,"");
- //Validate urls
- if (isUrl(textureURL) && isUrl(heightmapURL)){
- //Post to server
- $.post(
- loadUrl,
- { texture: textureURL, heightmap: heightmapURL },
- function(response) {
- console.log(response);
- }
- );
- } else {
- //Invalid URL(s)
- alert("Texture and/or heightmap URLs are invalid.\nAlso note that only JPG pictures are supported!");
- }
+ console.log(textureURL);
+ console.log(heightmapURL);
+ stop_animating();
+ var new_texture = '/cgi-bin/proxy?'+textureURL;
+ var new_heightmap = '/cgi-bin/proxy?'+heightmapURL;
+ initGraphics(new_texture, new_heightmap, function(){ animate() } );
}
function isUrl(s) {