summaryrefslogtreecommitdiff
path: root/js/pb.js
diff options
context:
space:
mode:
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) {