repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 96ad509978a1acd1e483284490d3c9106b65b27a:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 96ad509978a1acd1e483284490d3c9106b65b27a
Author: James Baicoianu 
Date:   Thu Apr 28 03:21:42 2016 -0700

    Fix for color and rotation in edit mode

diff --git a/scripts/janusbase.js b/scripts/janusbase.js
index f602cc62c76e356150ef6892ce91d4e8cca0040b..
index ..79c071e2488e5219dff5d81781e8b9fa837c4e00 100644
--- a/scripts/janusbase.js
+++ b/scripts/janusbase.js
@@ -1,6 +1,6 @@
 elation.require(['engine.things.generic', 'utils.template'], function() {
   elation.template.add('janusweb.edit.object', 
-      '');
+      '');

   elation.component.add('engine.things.janusbase', function() {
     this.postinit = function() {
@@ -37,17 +37,28 @@ elation.require(['engine.things.generic', 'utils.template'], function() {
     this.summarizeXML = function() {
       //'');

-      var xml = elation.template.get('janusweb.edit.object', {
+      var matrix = new THREE.Matrix4().makeRotationFromQuaternion(this.properties.orientation);
+      var xdir = new THREE.Vector3(),
+          ydir = new THREE.Vector3(),
+          zdir = new THREE.Vector3();
+      matrix.extractBasis(xdir, ydir, zdir);
+
+      var objdef = {
         id: this.properties.render.model,
         js_id: this.properties.js_id,
         pos: this.properties.position,
         vel: this.properties.velocity,
         accel: this.properties.acceleration,
         scale: this.properties.scale,
+        xdir: xdir.toArray().join(' '),
+        ydir: ydir.toArray().join(' '),
+        zdir: zdir.toArray().join(' '),
         col: this.properties.col,
         lighting: this.properties.lighting,
         visible: this.properties.visible,
-      });
+      };
+
+      var xml = elation.template.get('janusweb.edit.object', objdef);
       return xml;
     }


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