repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 8c09998064f7378b37d251b6d16d1faeb36d6003:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 8c09998064f7378b37d251b6d16d1faeb36d6003
Author: James Baicoianu 
Date:   Thu Oct 19 20:48:44 2017 -0700

    Support 4-element vectors for V()

diff --git a/scripts/janusweb.js b/scripts/janusweb.js
index aa3c48a6994a0a4078e283812bb051ded570458c..
index ..1d37c07cf8cbdad8266e795fe49b0cf80ecb19cc 100644
--- a/scripts/janusweb.js
+++ b/scripts/janusweb.js
@@ -172,15 +172,15 @@ elation.require(['janusweb.config', 'engine.things.generic','janusweb.remoteplay
       });

       //THREE.Vector3.prototype.toString = function() { return this.toArray().map(function(d) { return d.toFixed(4); }).join(' '); } 
-      window.Vector = function(x, y, z) {
+      window.Vector = function(x, y, z, w) {
         if (x) {
           if (x._target && x._target instanceof THREE.Vector3) return x._target.clone();
           if (x instanceof THREE.Vector3) return x.clone();
         }
         if (y === undefined) y = x;
         if (z === undefined) z = y;
-        var vec = new THREE.Vector3(x, y, z);
-        return vec;
+
+        return (w === undefined ? new THREE.Vector3(x, y, z) : new THREE.Vector4(x, y, z, w));
       }
       window.V = window.Vector;
       window.translate = function(v1, v2) {

-----END OF PAGE-----