diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-02-12 20:23:41 -0800 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-02-12 20:23:41 -0800 |
| commit | 32785e06cd47fc6c5c64c7e9c077769a462ae5ea (patch) | |
| tree | 9fcd27d4b702f248639f58aec151b2f61946c006 /js/3D_Landscape.js | |
| parent | 57ad852b6e7e337b7a86d2f85ac95b480898b057 (diff) | |
moving over...adding cgi
Diffstat (limited to 'js/3D_Landscape.js')
| -rw-r--r-- | js/3D_Landscape.js | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/js/3D_Landscape.js b/js/3D_Landscape.js index ca71ea6..1619de5 100644 --- a/js/3D_Landscape.js +++ b/js/3D_Landscape.js @@ -42,6 +42,11 @@ 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));
+ is_generating = false;
+ toggle_background();
+ };
img.onload = function(){
context.drawImage(img, 0, 0);
@@ -99,6 +104,35 @@ function initGraphics(textureFile, heightmapFile, cb) { rot_x = mesh.rotation.x;
rot_y = mesh.rotation.y;
rot_z = mesh.rotation.z;
+ is_generating = false;
+ toggle_background();
+ cb();
+ };
+}
+
+var requestId;
+function loop() {
+ render();
+ requestId = window.requestAnimationFrame(loop);
+}
+function animate() {
+ if (!requestId) {
+ loop();
+ }
+}
+function stop_animating() {
+ if (requestId) {
+ window.cancelAnimationFrame(requestId);
+ requestId = undefined;
+ }
+}
+
+
+function render() {
+ renderer.render(scene, camera);
+}
+
+function init_controls(){
//{{{init controls
//Controls
@@ -169,32 +203,8 @@ function initGraphics(textureFile, heightmapFile, cb) { });
//}}}
- cb();
- };
-}
-
-var requestId;
-function loop() {
- render();
- requestId = window.requestAnimationFrame(loop);
-}
-function animate() {
- if (!requestId) {
- loop();
- }
-}
-function stop_animating() {
- if (requestId) {
- window.cancelAnimationFrame(requestId);
- requestId = undefined;
- }
}
-
-
-function render() {
- renderer.render(scene, camera);
-}
-
window.onload= function(e){
runWebGLSimulation();
+ init_controls();
}
|
