repo: janusweb
action: commit
revision: 
path_from: 
revision_from: 7d33b4b1ce8f4264651b6f9adee13c1999403b9d:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit 7d33b4b1ce8f4264651b6f9adee13c1999403b9d
Author: James Baicoianu 
Date:   Mon Jan 2 22:12:17 2017 -0800

    Added tests and assets

diff --git a/media/assets/github-identicon.png b/media/assets/github-identicon.png
new file mode 100644
index 0000000000000000000000000000000000000000..f172c26ad481ee63b2add980cf5bd24ccc1789ce
Binary files /dev/null and b/media/assets/github-identicon.png differ
diff --git a/media/assets/rooms/room1.jpg b/media/assets/rooms/room1.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..819d19053a655c87a7fe6642d77d5aa268933b85
Binary files /dev/null and b/media/assets/rooms/room1.jpg differ
diff --git a/media/assets/rooms/tile_d.png b/media/assets/rooms/tile_d.png
new file mode 100644
index 0000000000000000000000000000000000000000..ca52855e182cde34cf2e9a189a8777738dc054ec
Binary files /dev/null and b/media/assets/rooms/tile_d.png differ
diff --git a/media/assets/rooms/tile_g.png b/media/assets/rooms/tile_g.png
new file mode 100644
index 0000000000000000000000000000000000000000..63ad232a5d76e381792fe3ecd4c8db01b849b51b
Binary files /dev/null and b/media/assets/rooms/tile_g.png differ
diff --git a/media/assets/rooms/tile_n.png b/media/assets/rooms/tile_n.png
new file mode 100644
index 0000000000000000000000000000000000000000..89b87c856d267c48575cfe2e31922eebd17b72ab
Binary files /dev/null and b/media/assets/rooms/tile_n.png differ
diff --git a/media/assets/rooms/tile_s.png b/media/assets/rooms/tile_s.png
new file mode 100644
index 0000000000000000000000000000000000000000..32992e28eaa708b1973136dbdf06bd7e31366b78
Binary files /dev/null and b/media/assets/rooms/tile_s.png differ
diff --git a/media/tests/collisions.html b/media/tests/collisions.html
new file mode 100644
index 0000000000000000000000000000000000000000..0f11cce43bcdef2b1e21821cd543487a190ae747
--- /dev/null
+++ b/media/tests/collisions.html
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/media/tests/collisions.js b/media/tests/collisions.js
new file mode 100644
index 0000000000000000000000000000000000000000..3ba4199b94396872d8cdbcc1f630e16f1028e824
--- /dev/null
+++ b/media/tests/collisions.js
@@ -0,0 +1,21 @@
+
+room.onClick = function()
+{
+  //rain 10 cubes from the top
+  for (var i=0; i<10; ++i) {
+    room.createObject("Object", {id:"cube", collision_id:"cube", pos:Vector(Math.random()*10-5, 16.0, Math.random()*10-5), vel:Vector(Math.random()*.1-.05, Math.random()*.1-.05, Math.random()*.1-.05), col:Vector(Math.random(), Math.random(), Math.random()), scale:Vector(Math.random(), Math.random(), Math.random()), collision_static:"false"});   
+  }
+
+  //shoot a sphere from the face
+  var p = new Vector();
+  p.x = player.pos.x;
+  p.y = player.pos.y + 1.5;
+  p.z = player.pos.z;
+
+  var v = new Vector();
+  v.x = player.view_dir.x * 10.0;
+  v.y = player.view_dir.y * 10.0;
+  v.z = player.view_dir.z * 10.0;
+
+  room.createObject("Object", {id:"sphere", collision_id:"sphere", pos:p, vel:v, scale:Vector(0.5,0.5,0.5), col:Vector(Math.random(), Math.random(), Math.random()), collision_static:"false"});  
+}
diff --git a/media/tests/ghosts.html b/media/tests/ghosts.html
new file mode 100644
index 0000000000000000000000000000000000000000..a9f349c443b0c941d7302dc45747492569dac1b1
--- /dev/null
+++ b/media/tests/ghosts.html
@@ -0,0 +1,153 @@
+
+  
+    
+    
+    
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+    
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+
+
+
+
diff --git a/media/tests/imageid.html b/media/tests/imageid.html
new file mode 100644
index 0000000000000000000000000000000000000000..e441f033e5fdc4e51b7c5079dcdc50a5e09ac1a9
--- /dev/null
+++ b/media/tests/imageid.html
@@ -0,0 +1,13 @@
+
+  
+    
+    
+    
+  
+  
+    
+    
+    
+  
+
+
diff --git a/media/tests/images/water2.png b/media/tests/images/water2.png
new file mode 100644
index 0000000000000000000000000000000000000000..69e8bd453fb19367eaaef96a0e44fe1c6a8fd680
Binary files /dev/null and b/media/tests/images/water2.png differ
diff --git a/media/tests/keyboard.html b/media/tests/keyboard.html
new file mode 100644
index 0000000000000000000000000000000000000000..97e72b99e08ad559d5d4a2f23c63409462208b9e
--- /dev/null
+++ b/media/tests/keyboard.html
@@ -0,0 +1,8 @@
+
+  
+    
+  
+  
+    Hello
+  
+
diff --git a/media/tests/keyboard.js b/media/tests/keyboard.js
new file mode 100644
index 0000000000000000000000000000000000000000..ebbb7067455d5ea8835c3a97fb4b74e45640975d
--- /dev/null
+++ b/media/tests/keyboard.js
@@ -0,0 +1,8 @@
+room.onKeyDown = function(ev) {
+  console.log('key down!', ev);
+  room.objects['keystatus'].text = 'Pressed: ' + ev.keyCode;
+}
+room.onKeyUp = function(ev) {
+  console.log('key up!', ev);
+  room.objects['keystatus'].text = 'Released: ' + ev.keyCode;
+}
diff --git a/media/tests/lights.html b/media/tests/lights.html
new file mode 100644
index 0000000000000000000000000000000000000000..108c833af23d5709343a0da38d45e0bb46aec8de
--- /dev/null
+++ b/media/tests/lights.html
@@ -0,0 +1,11 @@
+
+  
+  
+  
+    
+
+    
+
+  
+
+
diff --git a/media/tests/models/gltf.html b/media/tests/models/gltf.html
new file mode 100644
index 0000000000000000000000000000000000000000..a75b857a0650cdca08a310f005e61cd53cd9e8c6
--- /dev/null
+++ b/media/tests/models/gltf.html
@@ -0,0 +1,19 @@
+
+  
+    
+    
+    
+    
+
+  
+  
+
+    
+    
+    
+    
+    
+
+  
+
+
diff --git a/media/tests/particles2.html b/media/tests/particles2.html
new file mode 100644
index 0000000000000000000000000000000000000000..d08a1421bbc4da73c428c4f66e98dac6f5023967
--- /dev/null
+++ b/media/tests/particles2.html
@@ -0,0 +1,25 @@
+
+  
+    
+    
+    
+
+    
+  
+  
+    
+
+
+
+
+
+
+
+  
+
+
diff --git a/media/tests/photospheres.html b/media/tests/photospheres.html
new file mode 100644
index 0000000000000000000000000000000000000000..6bed3f0a8428dc87b66bd83439fd2c47b5acef05
--- /dev/null
+++ b/media/tests/photospheres.html
@@ -0,0 +1,24 @@
+
+
+
+#Sphere
+
+
+#Images
+
+
+
+
+
+
+
+
+
+
+#Put images in the scene on spheres
+
+
+
+
+
+
diff --git a/media/tests/portal.html b/media/tests/portal.html
new file mode 100644
index 0000000000000000000000000000000000000000..3398bda4262583572c0aba385af89c560ac119db
--- /dev/null
+++ b/media/tests/portal.html
@@ -0,0 +1,9 @@
+
+  
+  
+  
+    
+    
+  
+
+
diff --git a/media/tests/scripts.html b/media/tests/scripts.html
new file mode 100644
index 0000000000000000000000000000000000000000..cd9127795aec73c2c9da423f57b2406d17686e39
--- /dev/null
+++ b/media/tests/scripts.html
@@ -0,0 +1,8 @@
+
+  
+    
+    
+  
+  
+  
+
diff --git a/media/tests/scripts2.html b/media/tests/scripts2.html
new file mode 100644
index 0000000000000000000000000000000000000000..461e2617e050ac5f0e439f91fbed2aa88e729d3c
--- /dev/null
+++ b/media/tests/scripts2.html
@@ -0,0 +1,9 @@
+
+  
+    
+  
+  
+    
+  
+
+
diff --git a/media/tests/scripttest.js b/media/tests/scripttest.js
new file mode 100644
index 0000000000000000000000000000000000000000..7524f862117be15f76fb4a7cc5e063b0155e9267
--- /dev/null
+++ b/media/tests/scripttest.js
@@ -0,0 +1,94 @@
+print('this is the test script!');
+//print('the room url is', janus.currenturl());
+room.poop = 1;
+var selectedObject = false, selectedColor = [1,1,1];
+
+room.onLoad = function() {
+  print('the room loaded!: ' + uniqueId());
+debugger;
+  room.createObject('object', {js_id: 'box', id: 'cube', pos: Vector(0, 1, 7), scale: Vector(2, 2, 0.1), col: Vector(1, 0, 0)});
+  room.createObject('text', {js_id: 'mytext', text: 'whazzup', pos: Vector(0, 1, 5), fwd: Vector(1,0,0), zdir: Vector(1,0,0), col: '#ff00ff'});
+}
+room.update = function() {
+console.log('do shit in room 1');
+  if (player.pos.x > 10) player.pos.x = 10;
+  if (player.pos.x < -10) player.pos.x = -10;
+  if (player.pos.z > 10) player.pos.z = 10;
+  if (player.pos.z < -10) player.pos.z = -10;
+
+  var obj = room.objects[player.cursor_object];
+/*
+  if (obj && obj !== selectedObject) {
+    selectedColor = Vector(obj.col.x, obj.col.y, obj.col.z);
+    selectedObject = obj;
+    obj.col = Vector(0,0,1);
+  } else if (selectedObject) {
+    selectedObject.col = selectedColor;
+    selectedObject = false;
+    selectedColor = false;
+  }
+*/
+}
+room.onKeyDown = function(ev) {
+  //print('KEY ME: "' + ev.keyCode + '"');
+  if (ev.keyCode == 'I') {
+    room.objects['mytext'].vel.y = 0.5;
+  }
+  if (ev.keyCode == 'K') {
+    room.objects['mytext'].vel.y = -0.5;
+  }
+  if (ev.keyCode == 'J') {
+    room.objects['mytext'].vel.x = -0.5;
+  }
+  if (ev.keyCode == 'L') {
+    room.objects['mytext'].vel.x = 0.5;
+  }
+  if (ev.keyCode == 'U') {
+    room.objects['mytext'].vel.z = -0.5;
+  }
+  if (ev.keyCode == 'O') {
+    room.objects['mytext'].vel.z = 0.5;
+  }
+  //print('test');
+}
+room.onKeyUp = function(ev) {
+  if (ev.keyCode == 'I') {
+    room.objects['mytext'].vel.y = 0;
+  }
+  if (ev.keyCode == 'K') {
+    room.objects['mytext'].vel.y = 0;
+  }
+  if (ev.keyCode == 'J') {
+    room.objects['mytext'].vel.x = 0;
+  }
+  if (ev.keyCode == 'L') {
+    room.objects['mytext'].vel.x = 0;
+  }
+  if (ev.keyCode == 'U') {
+    room.objects['mytext'].vel.z = 0;
+  }
+  if (ev.keyCode == 'O') {
+    room.objects['mytext'].vel.z = 0;
+  }
+}
+room.onMouseDown = function(ev) {
+  //print('MOUSE DOWN', player.cursor_object);
+  var obj = room.objects[player.cursor_object];
+  if (obj) {
+    selectedColor = Vector(obj.col.r, obj.col.g, obj.col.b);
+    selectedObject = obj;
+    obj.col = Vector(0,1,0);
+  }
+}
+room.onMouseUp = function(ev) {
+  //print('MOUSE UP', ev);
+  if (selectedObject && selectedColor) {
+    selectedObject.col = selectedColor;
+print('set color!', selectedColor);
+    selectedObject = false;
+    selectedColor = false;
+  }
+}
+room.onClick = function(ev) {
+  //print('CLICK', ev);
+}
diff --git a/media/tests/scripttest2.js b/media/tests/scripttest2.js
new file mode 100644
index 0000000000000000000000000000000000000000..e042e294112b472f3a2c030cc1ff27a3f868bf3f
--- /dev/null
+++ b/media/tests/scripttest2.js
@@ -0,0 +1,3 @@
+room.update = function() {
+  console.log('do shit in room 2', room.objects);
+}
diff --git a/media/tests/settimeout.html b/media/tests/settimeout.html
new file mode 100644
index 0000000000000000000000000000000000000000..5b39602a66f1ea5aa3f3879d29fc02867491539c
--- /dev/null
+++ b/media/tests/settimeout.html
@@ -0,0 +1,12 @@
+
+  
+   
+   
+   
+  
+  
+    
+  
+
+
+
diff --git a/media/tests/settimeout.js b/media/tests/settimeout.js
new file mode 100644
index 0000000000000000000000000000000000000000..ee62ecd53a6f55652c18ef4fd571770258126de1
--- /dev/null
+++ b/media/tests/settimeout.js
@@ -0,0 +1,43 @@
+var num = 0;
+var rowsize = 24;
+var conetimer = false;
+var cubetimer = false;
+
+room.onLoad = function() {
+  spawnSpheres();
+
+  conetimer = setInterval(function() { 
+    room.playSound('bloop');
+    spawnSingleObject('cone'); 
+  }, 5000);
+}
+
+room.onMouseDown = function() {
+  spawnSingleObject('cube');
+  if (cubetimer) {
+    clearInterval(cubetimer);
+  }
+  cubetimer = setInterval(function() { 
+    spawnSingleObject('cube'); 
+  }, 100);
+}
+room.onMouseUp = function() {
+  //spawnSingleObject('cylinder');
+  if (cubetimer) {
+    clearInterval(cubetimer);
+  }
+}
+
+room.update = function() {
+}
+
+function spawnSingleObject(type) {
+  var pos = num++ * 2;
+  room.createObject('Object', {id: type, js_id: 'thing_' + num, pos: Vector(pos % rowsize, Math.floor(pos / rowsize), 5), color: '1 0 0'});
+}
+
+function spawnSpheres() {
+  room.playSound('bonk');
+  spawnSingleObject('sphere');
+  setTimeout(spawnSpheres, 1000);
+}
diff --git a/media/tests/settimeout2.html b/media/tests/settimeout2.html
new file mode 100644
index 0000000000000000000000000000000000000000..89e9175450dfde2bfab64aa7ef3aff49cbb6ecd9
--- /dev/null
+++ b/media/tests/settimeout2.html
@@ -0,0 +1,13 @@
+
+  
+   
+   
+   
+  
+  
+    
+  
+
+
+
+
diff --git a/media/tests/settimeout2.js b/media/tests/settimeout2.js
new file mode 100644
index 0000000000000000000000000000000000000000..73c29980443d37bfb265812c33568f0c30543c1a
--- /dev/null
+++ b/media/tests/settimeout2.js
@@ -0,0 +1,33 @@
+var cubetimer = false;
+var num = 0,
+    rowsize = 20;
+
+room.onLoad = function() {
+  setInterval(function() { 
+    room.playSound('bloop');
+    spawnSingleObject('sphere'); 
+  }, 2000);
+}
+room.update = function() {
+}
+
+room.onMouseDown = function() {
+  spawnSingleObject('cube');
+  if (cubetimer) {
+    clearInterval(cubetimer);
+  }
+  cubetimer = setInterval(function() { 
+    spawnSingleObject('cube'); 
+  }, 100);
+}
+room.onMouseUp = function() {
+  //spawnSingleObject('cylinder');
+  if (cubetimer) {
+    clearInterval(cubetimer);
+  }
+}
+
+function spawnSingleObject(type) {
+  var pos = num++ * 2;
+  room.createObject('Object', {id: type, js_id: 'thing_' + num, pos: Vector(pos % rowsize, Math.floor(pos / rowsize), 5), color: '1 0 0'});
+}
diff --git a/media/tests/sounds/bloop.wav b/media/tests/sounds/bloop.wav
new file mode 100644
index 0000000000000000000000000000000000000000..1d76ff3e211e90e52b87214d7114cd3efde9edff
Binary files /dev/null and b/media/tests/sounds/bloop.wav differ
diff --git a/media/tests/sounds/bonk.wav b/media/tests/sounds/bonk.wav
new file mode 100644
index 0000000000000000000000000000000000000000..5bf7d517c38c30f6cb8afbd4cb4fec44f2ed8745
Binary files /dev/null and b/media/tests/sounds/bonk.wav differ
diff --git a/media/tests/textures.html b/media/tests/textures.html
new file mode 100644
index 0000000000000000000000000000000000000000..8848344e44e6aeffdb6f1dc7a910bfa27bde69fc
--- /dev/null
+++ b/media/tests/textures.html
@@ -0,0 +1,27 @@
+
+  
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+
+    
+    
+    
+  
+  
+
+    
+    
+
+  
+
diff --git a/media/tests/vivecrash.html b/media/tests/vivecrash.html
new file mode 100644
index 0000000000000000000000000000000000000000..9aa39e7c8509616244f6f1fea927a424c93c56db
--- /dev/null
+++ b/media/tests/vivecrash.html
@@ -0,0 +1,10 @@
+
+  
+   
+  
+  
+  
+
+
+
+
diff --git a/media/tests/vivecrash.js b/media/tests/vivecrash.js
new file mode 100644
index 0000000000000000000000000000000000000000..8be80862c14f8713d802ae1d72b3ba0ecbb977f2
--- /dev/null
+++ b/media/tests/vivecrash.js
@@ -0,0 +1,73 @@
+var cube, sphere;
+
+var label1, label2, label3, hud;
+var axis;
+
+room.onLoad = function() {
+  cube = room.createObject('Object', {
+    id: 'cube',
+    js_id: 'wtfd00d',
+    pos: Vector(1,0,5),
+    scale: Vector(0.1,0.1,0.1),
+    col: Vector(1,0,0)
+  });
+  sphere = room.createObject('Object', {
+    id: 'sphere',
+    js_id: 'wtfd00d2',
+    pos: Vector(-1,0,5),
+    scale: Vector(0.1,0.1,0.1),
+    col: Vector(1,0,0)
+  });
+
+  axis = room.createObject('Object', {
+    id: 'cylinder',
+    js_id: 'axisdir',
+    scale: V(.1,1,.1),
+    pos: V(0,0,0)
+  });
+  hud = room.createObject('Text', {
+    js_id: 'hud',
+    scale: V(1,1,1),
+    pos: V(0,1,0)
+  });
+
+  label1 = room.createObject('Text', {
+    js_id: 'label1',
+    pos: V(0.5,0.1,0)
+  });
+  label2 = room.createObject('Text', {
+    js_id: 'label2',
+    pos: V(0.5,0.05,0)
+  });
+  label3 = room.createObject('Text', {
+    js_id: 'label3',
+    pos: V(0.5,0,0)
+  });
+
+  hud.appendChild(label1);
+  hud.appendChild(label2);
+  hud.appendChild(label3);
+}
+
+room.update = function() {
+  label1.text = 'Player: ' + player.pos.x + ', ' + player.pos.y + ', ' + player.pos.z;
+  label2.text = 'Head  : ' + player.head_pos.x + ', ' + player.head_pos.y + ', ' + player.head_pos.z;
+  label3.text = 'Hand  : ' + player.hand0_pos.x + ', ' + player.hand0_pos.y + ', ' + player.hand0_pos.z;
+
+  hud.pos = translate(player.pos, player.head_pos);
+  hud.zdir = player.zdir;
+
+  if (player.hand0_active) {
+    cube.col = V(0,1,0);
+    //cube.pos = translate(player.hand0_pos, player.pos);
+    cube.pos = player.hand0_pos;
+  } else {
+    cube.col = V(1,0,0);
+  }
+  if (player.hand1_active) {
+    sphere.col = V(0,1,0);
+    sphere.pos = player.hand1_pos;
+  } else {
+    sphere.col = V(1,0,0);
+  }
+}

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