-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Conversation
@@ -7,7 +7,7 @@ | |||
<script src="../../../dist/aframe-master.js"></script> | |||
</head> | |||
<body> | |||
<a-scene> | |||
<a-scene debug> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unintended?
src/components/look-controls.js
Outdated
hmdQuaternion = hmdQuaternion.copy(this.dolly.quaternion); | ||
hmdEuler.setFromQuaternion(hmdQuaternion, 'YXZ'); | ||
hmdEuler.setFromQuaternion(object3D.quaternion, 'YXZ'); | ||
console.log(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log();
src/core/scene/a-scene.js
Outdated
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^cruft
src/components/look-controls.js
Outdated
}, | ||
|
||
play: function () { | ||
this.camera = this.el.getObject3D('camera'); |
There was a problem hiding this comment.
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.
Note the work in progress label |
70e3e45
to
8bdcf25
Compare
I know it's a WIP, just giving my feedback. |
f75a7ad
to
7714553
Compare
@vincentfretin Thanks for testing. I believe it now should work on GearVR as expected and also Daydream. |
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. |
@fernandojsg If you want to throw up, you can test that branch with GearVR. :) |
@vincentfretin what example are you running? |
On my project actually https://github.com/vincentfretin/aframe-sandbox |
I use yarn with yarn workspaces in my project. If you want to test it with your branch:
|
src/utils/device.js
Outdated
|
||
/** | ||
* 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo vrDissplay => vrDisplay
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? |
7714553
to
41b5276
Compare
642613d
to
5108b68
Compare
Comments are obsolete after all the code changes
dd370c2
to
3042b9b
Compare
r? |
src/components/look-controls.js
Outdated
}, | ||
|
||
/** | ||
* Handle positional tracking. | ||
*/ | ||
* Handle positional tracking. |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
src/core/scene/a-scene.js
Outdated
@@ -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(); |
There was a problem hiding this comment.
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
src/core/scene/a-scene.js
Outdated
@@ -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) { |
There was a problem hiding this comment.
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?
src/core/scene/a-scene.js
Outdated
// 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)) { |
There was a problem hiding this comment.
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
src/core/scene/a-scene.js
Outdated
@@ -453,18 +433,19 @@ module.exports.AScene = registerElement('a-scene', { | |||
}, | |||
|
|||
resize: { | |||
value: function () { | |||
value: function (ll) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused?
src/core/scene/a-scene.js
Outdated
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(); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
tests/components/camera.test.js
Outdated
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}); |
There was a problem hiding this comment.
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?
tests/core/controls.test.js
Outdated
var cameraEl = el.sceneEl.querySelector('[camera]'); | ||
this.orientation = [0, Math.PI, 0]; | ||
el.sceneEl.render(); | ||
var rotation = cameraEl.getAttribute('rotation'); |
There was a problem hiding this comment.
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
3042b9b
to
9073d3e
Compare
I moved all the userHeight logic from |
9073d3e
to
1fb47bc
Compare
All the comments have been addressed |
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? |
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 |
AFAIK at the moment, they still need to add Rift support to Chrome Canary - but soon experimental Chromium may not be necessary at all |
A couple of more style-related nits to address from before and then r+wc |
bcd4392
to
bfd274e
Compare
bfd274e
to
b72d93c
Compare
Ok, I tested latest master, works great now on GearVR. |
@vincentfretin Thank you 🙏 |
Tested on:
Moving THREE dependency to the dev branch temporarly until r88 release.