Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove VREffect / VRControls in favor of the new WebGLRenderer API #3152

Merged
merged 1 commit into from
Dec 12, 2017

Conversation

dmarcos
Copy link
Member

@dmarcos dmarcos commented Oct 11, 2017

Tested on:

  • Desktop no headset
  • Vive
  • Oculus
  • Windows Mixed Reality
  • Daydream
  • GearVR
  • Cardboard (Android)
  • Cardboard (iOS)

Moving THREE dependency to the dev branch temporarly until r88 release.

@@ -7,7 +7,7 @@
<script src="../../../dist/aframe-master.js"></script>
</head>
<body>
<a-scene>
<a-scene debug>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unintended?

hmdQuaternion = hmdQuaternion.copy(this.dolly.quaternion);
hmdEuler.setFromQuaternion(hmdQuaternion, 'YXZ');
hmdEuler.setFromQuaternion(object3D.quaternion, 'YXZ');
console.log();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log();

@@ -123,7 +121,7 @@ module.exports.AScene = registerElement('a-scene', {
this.pointerUnrestrictedBound = function () { self.pointerUnrestricted(); };

// Enter VR on `vrdisplayactivate` (e.g. putting on Rift headset).
window.addEventListener('vrdisplayactivate', this.enterVRBound);
// window.addEventListener('vrdisplayactivate', this.enterVRBound);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^cruft

},

play: function () {
this.camera = this.el.getObject3D('camera');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anywhere this.camera is being used.

@dmarcos
Copy link
Member Author

dmarcos commented Oct 14, 2017

Note the work in progress label

@vincentfretin
Copy link
Contributor

I know it's a WIP, just giving my feedback.
On GearVR, Oculus browser and Samsung Internet, in or out vr mode, the eyes stay at y:0. In vr mode, the controller model appears at configured user-height.
With Samsung Internet, not in vr mode, the camera doesn't move anymore. In Oculus browser, this never worked.

@dmarcos dmarcos force-pushed the removeVREffect branch 4 times, most recently from f75a7ad to 7714553 Compare November 2, 2017 11:54
@dmarcos
Copy link
Member Author

dmarcos commented Nov 2, 2017

@vincentfretin Thanks for testing. I believe it now should work on GearVR as expected and also Daydream.

@vincentfretin
Copy link
Contributor

I tested on GearVR. For the user height stuff, it's ok now. But there is really something wrong with the camera, it seems that it's the ground that move, not my head. I really want to throw up right now, seriously. :) With a cursor on camera, the cursor doesn't follow my head, it stays where it was initially.

@vincentfretin
Copy link
Contributor

@fernandojsg If you want to throw up, you can test that branch with GearVR. :)

@dmarcos
Copy link
Member Author

dmarcos commented Nov 2, 2017

@vincentfretin what example are you running?

@vincentfretin
Copy link
Contributor

On my project actually https://github.com/vincentfretin/aframe-sandbox
On which example are you testing? So we can test the same thing.

@vincentfretin
Copy link
Contributor

I use yarn with yarn workspaces in my project. If you want to test it with your branch:

git clone git@github.com:vincentfretin/aframe-sandbox.git
cd aframe-sandbox
./workspaces-install.sh
cd workspaces/aframe
git remote add dmarcos git@github.com:dmarcos/aframe.git
git fetch dmarcos removeVREffect
git checkout -b removeVREffect dmarcos/removeVREffect
cd -
yarn
replace `"main": "dist/aframe-master.js"` by `"main": "src/index.js"` in `node_modules/aframe/package.json`
npm start


/**
* Determine if a headset is connected by checking if the orientation is available.
* Determine if a headset is connected by checking if a vrDissplay is available.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo vrDissplay => vrDisplay

@vincentfretin
Copy link
Contributor

I tried to understand the changes of this PR, but this is too advanced for me to say what could be the issue. Can you see what I describe at least?

@dmarcos dmarcos force-pushed the removeVREffect branch 3 times, most recently from 642613d to 5108b68 Compare December 6, 2017 10:09
@dmarcos dmarcos dismissed donmccurdy’s stale review December 6, 2017 10:17

Comments are obsolete after all the code changes

@dmarcos dmarcos force-pushed the removeVREffect branch 4 times, most recently from dd370c2 to 3042b9b Compare December 7, 2017 08:11
@dmarcos
Copy link
Member Author

dmarcos commented Dec 7, 2017

r?

},

/**
* Handle positional tracking.
*/
* Handle positional tracking.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstring messed up a bit

},
// Calculate polyfilled HMD quaternion.
this.polyfillControls.update();
hmdEuler.setFromQuaternion(this.polyfillObject.quaternion, 'YXZ');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always wondered how come we do YXZ order?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the best order to prevent gimbal lock when converting Euler <-> Quaternions.

@@ -242,24 +231,23 @@ module.exports.AScene = registerElement('a-scene', {
enterVR: {
value: function (fromExternal) {
var self = this;
var effect = this.effect;

var vrDisplay = utils.device.getVRDisplay();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can initialize this in the if where it's needed

@@ -325,14 +313,6 @@ module.exports.AScene = registerElement('a-scene', {
if (self.isIOS) { utils.forceCanvasResizeSafariMobile(this.canvas); }
self.emit('exit-vr', {target: self});
}

function exitVRFailure (err) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will three.js notify on errors?

// Enter VR via WebVR API.
if (!fromExternal && (this.checkHeadsetConnected() || this.isMobile)) {
return effect && effect.requestPresent().then(enterVRSuccess, enterVRFailure) || Promise.reject(new Error('VREffect not initialized'));
if (!fromExternal && (self.checkHeadsetConnected() || self.isMobile)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need to use self here

@@ -453,18 +433,19 @@ module.exports.AScene = registerElement('a-scene', {
},

resize: {
value: function () {
value: function (ll) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused?

var camera = this.camera;
var canvas = this.canvas;
var embedded = this.getAttribute('embedded') && !this.is('vr-mode');
var size;
var isEffectPresenting = this.effect && this.effect.isPresenting;
var vrDevice = this.renderer.vr.getDevice();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can initialize these two variables out of the declaration block since they have some logic

@@ -610,18 +588,16 @@ module.exports.AScene = registerElement('a-scene', {
*/
render: {
value: function () {
var effect = this.effect;
var delta = this.clock.getDelta() * 1000;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to separate declare vars vs logic?

sceneEl.emit('exit-vr');
assert.shallowDeepEqual(cameraEl.getAttribute('position'), {x: 0, y: 1.6, z: 0});
assert.shallowDeepEqual(cameraEl.getAttribute('position'), {x: 6, y: 6, z: 6});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a test preserve the user height check here?

var cameraEl = el.sceneEl.querySelector('[camera]');
this.orientation = [0, Math.PI, 0];
el.sceneEl.render();
var rotation = cameraEl.getAttribute('rotation');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vars on top for this file

@dmarcos
Copy link
Member Author

dmarcos commented Dec 8, 2017

I moved all the userHeight logic from camera to look-controls. It always felt weird to have the idea of user associated to the camera.

@dmarcos
Copy link
Member Author

dmarcos commented Dec 8, 2017

All the comments have been addressed

@cvan
Copy link
Contributor

cvan commented Dec 8, 2017

been watching this and testing locally. nice work! 👍

which Windows Mixed Reality headsets and which Android phones for Gear VR + Cardboard did you test with?

though it's deprecated, just out of curiosity, have you tested on desktop Chromium?

@dmarcos
Copy link
Member Author

dmarcos commented Dec 8, 2017

WebVR is already available on desktop Canary. If there’s any problem with the old Chromium builds I would encourage users to move to Canary.

It should not make any difference what Window MR headset it is tested on. I only have an Acer available.

For GearVR all devices should be equivalent besides performance capabilities. My testing device is a Galaxy S6

@machenmusik
Copy link
Contributor

AFAIK at the moment, they still need to add Rift support to Chrome Canary - but soon experimental Chromium may not be necessary at all

@ngokevin
Copy link
Member

ngokevin commented Dec 8, 2017

A couple of more style-related nits to address from before and then r+wc

@dmarcos dmarcos force-pushed the removeVREffect branch 2 times, most recently from bcd4392 to bfd274e Compare December 12, 2017 09:11
@dmarcos dmarcos merged commit 3d188db into aframevr:master Dec 12, 2017
@vincentfretin
Copy link
Contributor

Ok, I tested latest master, works great now on GearVR.

@dmarcos
Copy link
Member Author

dmarcos commented Feb 2, 2018

@vincentfretin Thank you 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants