From 6dc9faf49380ed486053c2ac1abb5417ef29a124 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Mon, 6 Jul 2015 22:22:21 +0200 Subject: [PATCH] Cleaned a little --- js/l3d/src/cameras/FixedCamera.js | 5 +---- js/l3d/src/cameras/ReplayCamera.js | 12 +++--------- js/l3d/src/recommendations/ViewportRecommendation.js | 9 --------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/js/l3d/src/cameras/FixedCamera.js b/js/l3d/src/cameras/FixedCamera.js index 88452a3..ddd007d 100644 --- a/js/l3d/src/cameras/FixedCamera.js +++ b/js/l3d/src/cameras/FixedCamera.js @@ -19,10 +19,7 @@ L3D.FixedCamera = function(arg1, arg2, arg3, arg4, position, target) { } - this.position.x = position.x; - this.position.y = position.y; - this.position.z = position.z; - + this.position.copy(position); this.target = target.clone(); }; diff --git a/js/l3d/src/cameras/ReplayCamera.js b/js/l3d/src/cameras/ReplayCamera.js index 78e2716..bc24acc 100644 --- a/js/l3d/src/cameras/ReplayCamera.js +++ b/js/l3d/src/cameras/ReplayCamera.js @@ -59,9 +59,7 @@ L3D.ReplayCamera.prototype.update = function(time) { L3D.ReplayCamera.prototype.linearMotion = function(time) { var tmp = L3D.Tools.sum(L3D.Tools.mul(this.old_position, 1-this.t), L3D.Tools.mul(this.new_position, this.t)); - this.position.x = tmp.x; - this.position.y = tmp.y; - this.position.z = tmp.z; + this.position.copy(tmp); this.t += 0.1 * time / 20; if (this.t > 1) { @@ -72,9 +70,7 @@ L3D.ReplayCamera.prototype.linearMotion = function(time) { L3D.ReplayCamera.prototype.cameraMotion = function(time) { var tmp = L3D.Tools.sum(L3D.Tools.mul(this.old_position, 1-this.t), L3D.Tools.mul(this.new_position, this.t)); - this.position.x = tmp.x; - this.position.y = tmp.y; - this.position.z = tmp.z; + this.position.copy(tmp); this.target = L3D.Tools.sum(L3D.Tools.mul(this.old_target, 1-this.t), L3D.Tools.mul(this.new_target, this.t)); this.t += 1 / (((new Date(this.path[this.counter].time)).getTime() - (new Date(this.path[this.counter-1].time)).getTime()) / 20); @@ -85,9 +81,7 @@ L3D.ReplayCamera.prototype.cameraMotion = function(time) { L3D.ReplayCamera.prototype.hermiteMotion = function(time) { var e = this.hermitePosition.eval(this.t); - this.position.x = e.x; - this.position.y = e.y; - this.position.z = e.z; + this.position.copy(tmp); this.target = L3D.Tools.sum(this.position, this.hermiteAngles.eval(this.t)); diff --git a/js/l3d/src/recommendations/ViewportRecommendation.js b/js/l3d/src/recommendations/ViewportRecommendation.js index a9ee8db..725c04c 100644 --- a/js/l3d/src/recommendations/ViewportRecommendation.js +++ b/js/l3d/src/recommendations/ViewportRecommendation.js @@ -7,15 +7,6 @@ L3D.ViewportRecommendation = function(arg1, arg2, arg3, arg4, position, target) { L3D.BaseRecommendation.apply(this, arguments); - // Set Position - if (position === undefined) { - this.camera.position = new THREE.Vector3(0,0,5); - } else { - this.camera.position.x = position.x; - this.camera.position.y = position.y; - this.camera.position.z = position.z; - } - if (target === undefined) target = new THREE.Vector3(0,0,0);