From d1788dac939a1edf5471429f52a74a273c7285c3 Mon Sep 17 00:00:00 2001 From: Saorel Date: Wed, 12 Jun 2013 16:35:45 +0200 Subject: [PATCH] Add Quad.js to be able to code a raymarcher after / Turn off auto rotate (maybe I would add a button) --- sources/shdr/App.coffee | 2 +- sources/shdr/App.js | 23 +++++++++++++---------- sources/shdr/Bootstrap.js | 2 +- sources/shdr/Models.coffee | 6 +++++- sources/shdr/Models.js | 5 ++++- sources/shdr/Snippets.js | 2 +- sources/shdr/Storage.js | 5 ++--- sources/shdr/UI.js | 3 +-- sources/shdr/Validator.js | 12 +++++++----- sources/shdr/Viewer.coffee | 4 ++-- sources/shdr/Viewer.js | 5 ++--- 11 files changed, 39 insertions(+), 30 deletions(-) diff --git a/sources/shdr/App.coffee b/sources/shdr/App.coffee index f1e9629..da52228 100644 --- a/sources/shdr/App.coffee +++ b/sources/shdr/App.coffee @@ -298,4 +298,4 @@ class App object @shdr ||= {} -@shdr.App = App \ No newline at end of file +@shdr.App = App diff --git a/sources/shdr/App.js b/sources/shdr/App.js index 4fbbb0b..304785b 100644 --- a/sources/shdr/App.js +++ b/sources/shdr/App.js @@ -1,9 +1,8 @@ -// Generated by CoffeeScript 1.4.0 +// Generated by CoffeeScript 1.6.3 (function() { var App; App = (function() { - App.UPDATE_ALL = 0; App.UPDATE_ENTER = 1; @@ -61,11 +60,12 @@ }; App.prototype.initViewer = function(domCanvas) { - var conf, msg; + var conf, e, msg; try { this.viewer = new shdr.Viewer(this.byId(domCanvas), this); this.validator = new shdr.Validator(this.viewer.canvas); - } catch (e) { + } catch (_error) { + e = _error; console.warn(e); msg = "Unable to start Shdr. \n\nWebGL is either deactivated or not supported by your device or browser. \n\nWould you like to visit get.webgl.org for more info?"; this.ui.setStatus(msg, shdr.UI.WARNING); @@ -175,7 +175,7 @@ }; App.prototype.packURL = function() { - var json, obj, packed; + var e, json, obj, packed; try { obj = { documents: this.documents, @@ -184,13 +184,14 @@ json = JSON.stringify(obj); packed = window.btoa(RawDeflate.deflate(json)); return this.baseurl + '#1/' + packed; - } catch (e) { + } catch (_error) { + e = _error; return this.ui.setStatus("Unable to pack document: " + (typeof e.getMessage === "function" ? e.getMessage() : void 0), shdr.UI.WARNING); } }; App.prototype.unpackURL = function() { - var hash, json, obj, packed, version; + var e, hash, json, obj, packed, version; if (!window.location.hash) { return false; } @@ -201,7 +202,8 @@ json = RawDeflate.inflate(window.atob(packed)); obj = JSON.parse(json); return obj; - } catch (e) { + } catch (_error) { + e = _error; return this.ui.setStatus("Unable to unpack document: " + (typeof e.getMessage === "function" ? e.getMessage() : void 0), shdr.UI.WARNING); } }; @@ -239,7 +241,7 @@ }; App.prototype.download = function() { - var blob, url, win; + var blob, e, url, win; try { blob = new Blob([this.editor.getSession().getValue()], { type: 'text/plain' @@ -251,7 +253,8 @@ } else { this.ui.setStatus('Your browser as blocked the download, please disable popup blocker.', shdr.UI.WARNING); } - } catch (e) { + } catch (_error) { + e = _error; this.ui.setStatus('Your browser does not support Blob, unable to download.', shdr.UI.WARNING); } return url; diff --git a/sources/shdr/Bootstrap.js b/sources/shdr/Bootstrap.js index b32e9cf..c5dd22c 100644 --- a/sources/shdr/Bootstrap.js +++ b/sources/shdr/Bootstrap.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.4.0 +// Generated by CoffeeScript 1.6.3 (function() { var _this = this; diff --git a/sources/shdr/Models.coffee b/sources/shdr/Models.coffee index 4f870d1..31cdc64 100644 --- a/sources/shdr/Models.coffee +++ b/sources/shdr/Models.coffee @@ -3,6 +3,10 @@ Models = 'models/cube.js': name: 'Cube' + + 'models/quad.js': + name: 'Quad' + 'models/sphere.js': name: 'Shere' @@ -24,4 +28,4 @@ Models = name: 'Suzanne (high)' @shdr ||= {} -@shdr.Models = Models \ No newline at end of file +@shdr.Models = Models diff --git a/sources/shdr/Models.js b/sources/shdr/Models.js index b6ada5a..eb1eef9 100644 --- a/sources/shdr/Models.js +++ b/sources/shdr/Models.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.4.0 +// Generated by CoffeeScript 1.6.3 (function() { var Models; @@ -6,6 +6,9 @@ 'models/cube.js': { name: 'Cube' }, + 'models/quad.js': { + name: 'Quad' + }, 'models/sphere.js': { name: 'Shere' }, diff --git a/sources/shdr/Snippets.js b/sources/shdr/Snippets.js index 4b6945c..5e443db 100644 --- a/sources/shdr/Snippets.js +++ b/sources/shdr/Snippets.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.4.0 +// Generated by CoffeeScript 1.6.3 (function() { var Snippets; diff --git a/sources/shdr/Storage.js b/sources/shdr/Storage.js index 7e91d08..84991e6 100644 --- a/sources/shdr/Storage.js +++ b/sources/shdr/Storage.js @@ -1,9 +1,8 @@ -// Generated by CoffeeScript 1.4.0 +// Generated by CoffeeScript 1.6.3 (function() { var Storage; Storage = (function() { - function Storage() {} Storage.PREFIX_SIZE = 4; @@ -58,7 +57,7 @@ }; Storage.getString = function(key) { - if (!(localStorage[key] != null)) { + if (localStorage[key] == null) { return null; } return localStorage[key]; diff --git a/sources/shdr/UI.js b/sources/shdr/UI.js index aa6f5f3..3d2c9dd 100644 --- a/sources/shdr/UI.js +++ b/sources/shdr/UI.js @@ -1,9 +1,8 @@ -// Generated by CoffeeScript 1.4.0 +// Generated by CoffeeScript 1.6.3 (function() { var UI; UI = (function() { - UI.ERROR = 0; UI.SUCCESS = 1; diff --git a/sources/shdr/Validator.js b/sources/shdr/Validator.js index 79f6f27..1a96102 100644 --- a/sources/shdr/Validator.js +++ b/sources/shdr/Validator.js @@ -1,14 +1,14 @@ -// Generated by CoffeeScript 1.4.0 +// Generated by CoffeeScript 1.6.3 (function() { var Validator; Validator = (function() { - Validator.FRAGMENT = null; Validator.VERTEX = null; function Validator(canvas) { + var e; this.canvas = canvas; this.available = true; if (!this.canvas) { @@ -16,7 +16,8 @@ } try { this.context = canvas.getContext("webgl") || this.canvas.getContext("experimental-webgl"); - } catch (e) { + } catch (_error) { + e = _error; console.log(e); } if (!this.context) { @@ -29,7 +30,7 @@ } Validator.prototype.validate = function(source, type) { - var details, error, i, line, lines, log, message, shader, status, _i, _len; + var details, e, error, i, line, lines, log, message, shader, status, _i, _len; if (type == null) { type = Validator.FRAGMENT; } @@ -41,7 +42,8 @@ this.context.shaderSource(shader, source); this.context.compileShader(shader); status = this.context.getShaderParameter(shader, this.context.COMPILE_STATUS); - } catch (e) { + } catch (_error) { + e = _error; return [false, 0, e.getMessage]; } if (status === true) { diff --git a/sources/shdr/Viewer.coffee b/sources/shdr/Viewer.coffee index e7dab4f..79e0c6e 100644 --- a/sources/shdr/Viewer.coffee +++ b/sources/shdr/Viewer.coffee @@ -5,7 +5,7 @@ class Viewer constructor: (@dom, @app) -> @time = 0.0 - @rotate = true + @rotate = false @currentModel = null @rotateRate = 0.005 @renderer = new THREE.WebGLRenderer(antialias: on) @@ -84,4 +84,4 @@ class Viewer ) @shdr ||= {} -@shdr.Viewer = Viewer \ No newline at end of file +@shdr.Viewer = Viewer diff --git a/sources/shdr/Viewer.js b/sources/shdr/Viewer.js index 7668a88..0e95f26 100644 --- a/sources/shdr/Viewer.js +++ b/sources/shdr/Viewer.js @@ -1,9 +1,8 @@ -// Generated by CoffeeScript 1.4.0 +// Generated by CoffeeScript 1.6.3 (function() { var Viewer; Viewer = (function() { - Viewer.FRAGMENT = 0; Viewer.VERTEX = 1; @@ -13,7 +12,7 @@ this.dom = dom; this.app = app; this.time = 0.0; - this.rotate = true; + this.rotate = false; this.currentModel = null; this.rotateRate = 0.005; this.renderer = new THREE.WebGLRenderer({