repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 9ffa8220191eb924f96a22c6ca8687f5c6c74a5b:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 9ffa8220191eb924f96a22c6ca8687f5c6c74a5b
Author: James Baicoianu 
Date:   Thu Apr 28 03:33:07 2016 -0700

    Added error translator, use video.loop, brighter color, absolute mtl file url fix

diff --git a/scripts/room.js b/scripts/room.js
index cb09e300c962a46c7c445b9bfdb48463456ceac7..
index ..df98f271e0f9e512c17f83856dc9745c83085b27 100644
--- a/scripts/room.js
+++ b/scripts/room.js
@@ -2,7 +2,7 @@ elation.require([
     'ui.textarea', 'ui.window', 
      'engine.things.generic', 'engine.things.sound', 'engine.things.label', 
     'janusweb.object', 'janusweb.portal', 'janusweb.image', 'janusweb.video', 'janusweb.text',
-    'janusweb.translators.bookmarks', 'janusweb.translators.reddit'
+    'janusweb.translators.bookmarks', 'janusweb.translators.reddit', 'janusweb.translators.error'
   ], function() {
   elation.component.add('engine.things.janusroom', function() {
     this.postinit = function() {
@@ -26,7 +26,8 @@ elation.require([
       });
       this.translators = {
         '^bookmarks$': elation.janusweb.translators.bookmarks({}),
-        '^https?:\/\/(www\.)?reddit.com': elation.janusweb.translators.reddit({})
+        '^https?:\/\/(www\.)?reddit.com': elation.janusweb.translators.reddit({}),
+        '^error$': elation.janusweb.translators.error({})
       };
       this.playerstartposition = [0,0,0];
       this.playerstartorientation = new THREE.Quaternion();
@@ -36,7 +37,7 @@ elation.require([
     }
     this.createChildren = function() {
       this.spawn('light_ambient', this.id + '_ambient', {
-        color: 0x222222
+        color: 0x333333
       });
       this.spawn('light_directional', this.id + '_sun', {
         position: [-20,50,25],
@@ -242,8 +243,14 @@ elation.require([
               console.log('no firebox room, load the translator', transpath);
               this.load(transpath + 'Parallelogram.html', transpath );
             }
+          }), 
+          failurecallback: elation.bind(this, function() {
+            var translator = this.translators['^error$'];
+            translator.exec({janus: this.properties.janus, room: this})
+                      .then(elation.bind(this, this.createRoomObjects));
+            
           })
-        }); 
+        });
       }
     }
     this.parseSource = function(data) { 
@@ -310,6 +317,7 @@ setTimeout(elation.bind(this, function() {
           //'scale': n.scale,
           'image_id': n.image_id,
           'video_id': n.video_id,
+          'loop': n.loop,
           'collision_id': n.collision_id,
           'websurface_id': n.websurface_id,
           'col': n.col,
@@ -599,6 +607,7 @@ setTimeout(elation.bind(this, function() {
           assettype:'video', 
           name:n.id, 
           src: src, 
+          loop: n.loop,
           sbs3d: n.sbs3d == 'true',  
           ou3d: n.ou3d == 'true',  
           auto_play: n.auto_play == 'true',  
@@ -613,7 +622,7 @@ setTimeout(elation.bind(this, function() {
         if (n.src) {
           var src = (n.src.match(/^file:/) ? n.src.replace(/^file:/, datapath) : n.src);
           var mtlsrc = (n.mtl && n.mtl.match(/^file:/) ? n.mtl.replace(/^file:/, datapath) : n.mtl);
-          if (mtlsrc && !mtlsrc.match(/^https?:/)) mtlsrc = baseurl + mtlsrc;
+          if (mtlsrc && !mtlsrc.match(/^(https?:)?\/\//)) mtlsrc = baseurl + mtlsrc;
           var srcparts = src.split(' ');
           src = srcparts[0];
           objlist.push({assettype: 'model', name: n.id, src: src, mtl: mtlsrc, tex_linear: n.tex_linear, tex0: n.tex || n.tex0 || srcparts[1], tex1: n.tex1 || srcparts[2], tex2: n.tex2 || srcparts[3], tex3: n.tex3 || srcparts[4]}); 
diff --git a/scripts/translators/error.js b/scripts/translators/error.js
new file mode 100644
index 0000000000000000000000000000000000000000..3edc9c0db20363e874e6f787f53988f045b82de3
--- /dev/null
+++ b/scripts/translators/error.js
@@ -0,0 +1,48 @@
+elation.require([], function() {
+  elation.component.add('janusweb.translators.error', function() {
+    this.exec = function(args) {
+      return new Promise(function(resolve, reject) {
+
+        var room = args.room;
+/*
+
+
+
+
+
+
+
+404 - Are you lost?
+
+
+
+
+*/
+        var datapath = elation.config.get('janusweb.datapath', '/media/janusweb');
+        var assetpath = datapath + 'assets/translator/errors/';
+
+        elation.engine.assets.loadJSON([
+          {assettype: 'model', name: 'stand', src: 'error.obj'},
+          {assettype: 'image', name: 'static', src: 'static.gif'}
+        ], assetpath);
+
+        var roomdata = {
+          room: {
+            pos: [0.8, -0.2, 0],
+            orientation: new THREE.Quaternion().setFromEuler(new THREE.Euler(0,0,0))
+          },
+          objects: [
+            room.parseNode({id: 'stand', js_id: 0, pos: "1 -0.1 4", xdir: "-1 0 0", zdir: "0 0 -1", col: "#ff0000", lighting: "false"}),
+            room.parseNode({id: 'sphere', js_id: 1, pos: "4 350 -1", xdir: "0 0 1", ydir: "0 -1 0", zdir: "1 0 0", scale: "400 400 400", col: "#190000", lighting: "false", cull_face: 'front', image_id: 'static'})
+          ],
+          texts: [
+            room.parseNode({ js_id: 2, pos: "1.3 1.4 12.5", xdir: "-1 0 0", zdir: "0 0 -1", scale: "6 6 1", col: "#ff0000", '_content': '404 - Are you lost?' })
+          ],
+          links: []
+        };
+        resolve(roomdata);
+      });
+    }
+  });
+});
+

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