From fe3429080232010febbc9a64909641d128a1e3be Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Fri, 22 May 2015 14:21:11 +0200 Subject: [PATCH] A little cleaning --- controllers/prototype/dbrequests.js | 4 ++-- static/js/PointerCamera.js | 4 ---- static/js/Tools.js | 20 ++++++++------------ 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/controllers/prototype/dbrequests.js b/controllers/prototype/dbrequests.js index 5118290..363be1f 100644 --- a/controllers/prototype/dbrequests.js +++ b/controllers/prototype/dbrequests.js @@ -21,11 +21,11 @@ var Info = function(id, finishAction) { pg.connect(pgc.url, function(err, client, release) { self.client = client; self.release = release; - self.loadAll(); + self.execute(); }); } -Info.prototype.loadAll = function() { +Info.prototype.execute = function() { this.loadCameras(); this.loadCoins(); this.loadArrows(); diff --git a/static/js/PointerCamera.js b/static/js/PointerCamera.js index f3e9620..efbcc6c 100644 --- a/static/js/PointerCamera.js +++ b/static/js/PointerCamera.js @@ -380,10 +380,6 @@ PointerCamera.prototype.redoable = function() { return this.history.redoable(); } -// Static members -PointerCamera.DISTANCE_X = 1000; -PointerCamera.DISTANCE_Z = 300; - var History = function() { this.states = new Array(); this.index = -1; diff --git a/static/js/Tools.js b/static/js/Tools.js index 8fb8732..4190f7d 100644 --- a/static/js/Tools.js +++ b/static/js/Tools.js @@ -1,15 +1,11 @@ var Tools = {version : "1.0" }; Tools.sum = function(v1, v2) { - var ret = v1.clone(); - ret.add(v2); - return ret; + return new THREE.Vector3(v1.x + v2.x, v1.y + v2.y, v1.z + v2.z); } Tools.diff = function(v1, v2) { - var ret = v1.clone(); - ret.sub(v2); - return ret; + return new THREE.Vector3(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z); } Tools.dot = function(v1, v2) { @@ -17,15 +13,15 @@ Tools.dot = function(v1, v2) { } Tools.cross = function(v1, v2) { - var ret = v1.clone(); - ret.cross(v2); - return ret; + return new THREE.Vector3( + v1.y * v2.z - v1.z * v2.y, + v1.z * v2.x - v1.x * v2.z, + v1.x * v2.y - v1.y * v2.x + ); } Tools.mul = function(v1, lambda) { - var ret = v1.clone(); - ret.multiplyScalar(lambda); - return ret; + return new THREE.Vector3(v1.x * lambda, v1.y * lambda, v1.z * lambda); } Tools.equals = function(v1, v2) {