From 13814814b82ce24e323a0fc909dd7b3e7a13cb0b Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Thu, 10 Nov 2016 22:38:38 -0800 Subject: [PATCH 01/10] test --- examples/tests/fullscreen.html | 54 ++++++++++++++++++++++++++++++++++ examples/tests/index.html | 1 + 2 files changed, 55 insertions(+) create mode 100644 examples/tests/fullscreen.html diff --git a/examples/tests/fullscreen.html b/examples/tests/fullscreen.html new file mode 100644 index 00000000..c4a97ae2 --- /dev/null +++ b/examples/tests/fullscreen.html @@ -0,0 +1,54 @@ + + + + Fullscreen + + + + + + + + + diff --git a/examples/tests/index.html b/examples/tests/index.html index e3ec4e12..37964da7 100644 --- a/examples/tests/index.html +++ b/examples/tests/index.html @@ -25,6 +25,7 @@ 'transparency-stress.html', 'canvas-update.html', 'document.html', + 'fullscreen.html', 'texture-repeat-offset.html', 'texture-batching.html', 'texture-reuse.html', From ee98cb5e99592f263cd2661f609c6f159ca98746 Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Tue, 15 Nov 2016 05:29:06 -0800 Subject: [PATCH 02/10] complete example --- examples/tests/fullscreen.html | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/examples/tests/fullscreen.html b/examples/tests/fullscreen.html index c4a97ae2..2a71c874 100644 --- a/examples/tests/fullscreen.html +++ b/examples/tests/fullscreen.html @@ -14,16 +14,15 @@ var boxGeo = new THREE.BoxGeometry(boxSize, boxSize, boxSize); var boxMat = new THREE.MeshBasicMaterial({color: 'green'}); - function makeBox(x, z) { + function makeBox(x, y, z) { var boxMesh = new THREE.Mesh(boxGeo, boxMat.clone()); - boxMesh.position.x = x; - boxMesh.position.z = z; + boxMesh.position.set(x, y, z); sim.scene.add(boxMesh); return boxMesh; } - function makeMovingBox(x, z) { - var boxMesh = makeBox(x, z); + function makeMovingBox(x, y, z) { + var boxMesh = makeBox(x, y, z); boxMesh.addBehavior({ awake: function (obj) { this.obj = obj; @@ -38,14 +37,29 @@ return boxMesh; } - makeBox(0, 0).addEventListener('cursordown', function () { + altspace.getEnclosure().then(function (enclosure) { + var button = makeBox(0, boxSize * 1.5, 0); + button.material.color.setStyle('white'); + button.addEventListener('cursordown', function () { + if (enclosure.fullscreen) { + enclosure.exitFullscreen(); + button.material.color.setStyle('white'); + } + else { + enclosure.requestFullscreen().then(function () { + button.material.color.setStyle('red'); + }); + } + }); }); var spacing = 200; - var num = 5; + var num = 7; for (var x = 0; x < num; x++) { for (var z = 0; z < num; z++) { - makeMovingBox(x * spacing, z * spacing); + makeMovingBox( + ((x / (num - 1)) - 0.5) * num * spacing, 0, + ((z / (num - 1)) - 0.5) * num * spacing) } } From 6c57da9764a326b74f9069b03972111b7195b17a Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Tue, 15 Nov 2016 19:24:37 -0800 Subject: [PATCH 03/10] more tweaks --- examples/tests/fullscreen.html | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/examples/tests/fullscreen.html b/examples/tests/fullscreen.html index 2a71c874..d1b3acd5 100644 --- a/examples/tests/fullscreen.html +++ b/examples/tests/fullscreen.html @@ -10,7 +10,7 @@ From 2b602b4106614bb364a28607ce04487ce83082de Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Thu, 17 Nov 2016 05:58:39 -0800 Subject: [PATCH 04/10] more tweaks --- examples/tests/fullscreen.html | 39 +++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/examples/tests/fullscreen.html b/examples/tests/fullscreen.html index d1b3acd5..28ca6dbd 100644 --- a/examples/tests/fullscreen.html +++ b/examples/tests/fullscreen.html @@ -1,12 +1,12 @@ - Fullscreen + Fullspace - + From c44afb998410ae4c95f5c329fe557957d319080a Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Thu, 17 Nov 2016 17:36:42 -0800 Subject: [PATCH 05/10] fullspacechange event --- examples/tests/fullscreen.html | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/examples/tests/fullscreen.html b/examples/tests/fullscreen.html index 28ca6dbd..d7d615a5 100644 --- a/examples/tests/fullscreen.html +++ b/examples/tests/fullscreen.html @@ -5,8 +5,15 @@ + - + +
 
From e9a807d91642b15969170fbb71f323fb99cb6e43 Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Fri, 18 Nov 2016 19:10:14 -0800 Subject: [PATCH 08/10] throw the collider flag into the test --- examples/tests/fullspace.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/tests/fullspace.html b/examples/tests/fullspace.html index 6b8a31da..24b2e4f2 100644 --- a/examples/tests/fullspace.html +++ b/examples/tests/fullspace.html @@ -23,6 +23,7 @@ function makeBox(x, y, z) { var boxMesh = new THREE.Mesh(boxGeo, boxMat.clone()); + boxMesh.userData.altspace = {collider: {enabled: false}}; boxMesh.position.set(x, y, z); sim.scene.add(boxMesh); return boxMesh; @@ -74,6 +75,7 @@ new THREE.SphereGeometry(1, 6, 6), new THREE.MeshBasicMaterial({color: 'white'}) ); + sphere.userData.altspace = {collider: {enabled: false}}; sphere.addBehavior({ awake: function (obj) { this.obj = obj; @@ -100,6 +102,7 @@ altspace.getEnclosure().then(function (enclosure) { var button = makeBox(0, boxSize * 1.5, 0); + button.userData.altspace.collider.enabled = true; adjustToFullscreen(enclosure, button); button.addEventListener('cursordown', function () { if (enclosure.fullspace) { @@ -127,6 +130,7 @@ box.material.color.r = x / num; box.material.color.g = y / num; box.material.color.b = z / num; + button.userData.altspace.collider.enabled = Math.random() > 0.5; } } } From ba5dbd6b612253bdbcfbb1143829908a565c3668 Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Mon, 21 Nov 2016 13:45:11 -0800 Subject: [PATCH 09/10] add getDocument to test --- examples/tests/fullspace.html | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/examples/tests/fullspace.html b/examples/tests/fullspace.html index 24b2e4f2..a3fb5cc4 100644 --- a/examples/tests/fullspace.html +++ b/examples/tests/fullspace.html @@ -9,7 +9,7 @@ html, body { width: 100%; height: 100%; margin: 0; padding: 0; } body{ display: flex; align-items: center; justify-content: center; } div { display: none; } - #pixel { display: block; width: 1px; height: 1px; background-color: black; } + #pixel { display: block; width: 300px; height: 300px; background-color: black; } @@ -93,17 +93,25 @@ return sphere; } - function adjustToFullscreen(enclosure, button) { + function adjustToFullspace(enclosure, button, doc) { var ppm = enclosure.pixelsPerMeter; sim.scene.scale.set(ppm, ppm, ppm); + doc.scale.set(1/ppm, 1/ppm, 1/ppm); button.material.color.setStyle(enclosure.fullspace ? 'red' : 'white'); pulsingSphere.getBehaviorByType('pulsingSphereBehavior').size = enclosure.fullspace ? 50 : 4; } - altspace.getEnclosure().then(function (enclosure) { + Promise.all([altspace.getEnclosure(), altspace.getDocument()]).then(function (results) { + var enclosure = results.shift(); + + var doc = results.shift(); + doc.position.set(0, 0, 1.5); + doc.rotateY(Math.PI / 4); + sim.scene.add(doc); + var button = makeBox(0, boxSize * 1.5, 0); button.userData.altspace.collider.enabled = true; - adjustToFullscreen(enclosure, button); + adjustToFullspace(enclosure, button, doc); button.addEventListener('cursordown', function () { if (enclosure.fullspace) { enclosure.exitFullspace(); @@ -113,7 +121,7 @@ } }); enclosure.addEventListener('fullspacechange', function () { - adjustToFullscreen(enclosure, button); + adjustToFullspace(enclosure, button, doc); }); }); @@ -130,7 +138,7 @@ box.material.color.r = x / num; box.material.color.g = y / num; box.material.color.b = z / num; - button.userData.altspace.collider.enabled = Math.random() > 0.5; + box.userData.altspace.collider.enabled = Math.random() > 0.5; } } } From 1763e94309380631d96a054eed215792fd0eebd1 Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Mon, 21 Nov 2016 17:44:37 -0800 Subject: [PATCH 10/10] Fix readme link formatting --- README.md.template | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md.template b/README.md.template index 77ed4f69..6513d943 100644 --- a/README.md.template +++ b/README.md.template @@ -14,12 +14,12 @@ THIS FILE IS GENERATED FROM README.md.template. EDIT THAT INSTEAD ## Resources -**[Getting Started] - If you're new to the SDK, start here!** -**[API Reference] - Reference for built in API functions, utilities, and more** -**[Developer Portal] - Tutorials, projects, initiative program, and app submission** -**[Local Dev Setup] - Instructions for setting up a local dev environment** -**[App Guidelines] - Suggestions for building apps that work well in Altspace and Gear VR** -**[Slack] - Chat with other members of the community and AltspaceVR devs. [Register for Slack](http://altspacevr-slackin.herokuapp.com)** +- **[Getting Started] - If you're new to the SDK, start here!** +- **[API Reference] - Reference for built in API functions, utilities, and more** +- **[Developer Portal] - Tutorials, projects, initiative program, and app submission** +- **[Local Dev Setup] - Instructions for setting up a local dev environment** +- **[App Guidelines] - Suggestions for building apps that work well in Altspace and Gear VR** +- **[Slack] - Chat with other members of the community and AltspaceVR devs. [Register for Slack](http://altspacevr-slackin.herokuapp.com)** ## altspace.js