Skip to content

Conversation

@olga-microsoft
Copy link
Contributor

@olga-microsoft olga-microsoft commented Sep 21, 2017

Renderer size should only be updated on desktop in fullscreen mode.
Resizing the browser window while presenting leads to the canvas being resized accordingly, which updates resolution in the headset, causing a bad experience. Since Aframe does not rely on Three.js built-in mechanism for resizing the canvas this needs to be handled explicitly in a-scene.js.
Alternative to #3075, follow-up of #3031

AScene.prototype.resize.restore();
sceneEl.camera = { updateProjectionMatrix: function () {} };
sceneEl.canvas = document.createElement('canvas');
sceneEl.renderer = { setSize: function () {} };
Copy link
Member

Choose a reason for hiding this comment

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

This code bellow is common to all the tests in the suite. Can we factor it out to a setup function? e.g: https://github.com/aframevr/aframe/blob/master/tests/core/scene/a-scene.test.js#L214

 var sceneEl = this.el;
 AScene.prototype.resize.restore();
 sceneEl.camera = { updateProjectionMatrix: function () {} };
 sceneEl.canvas = document.createElement('canvas');
 sceneEl.renderer = { setSize: function () {} };

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, thank you

});

suite('resize', function () {
test('resize not in vr updates renderer size', function () {
Copy link
Member

Choose a reason for hiding this comment

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

difficult to read. May be better like this? resize renderer when not in vr mode

assert.ok(setSizeSpy.called);
});

test('resize in non-immersive vr on desktop updates renderer size', function () {
Copy link
Member

Choose a reason for hiding this comment

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

resize renderer when in vr mode in fullscreen presentation (no headset)

assert.ok(setSizeSpy.called);
});

test('resize in vr on mobile does not update renderer size', function () {
Copy link
Member

Choose a reason for hiding this comment

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

does not resize renderer in vr mode on mobile devices

assert.notOk(setSizeSpy.called);
});

test('resize in immersive vr (while presenting) does not update renderer size', function () {
Copy link
Member

Choose a reason for hiding this comment

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

does not resize renderer when in vr mode and presenting in a headset

@dmarcos
Copy link
Member

dmarcos commented Sep 22, 2017

Thank you!

@dmarcos dmarcos merged commit 75ac4d8 into aframevr:master Sep 22, 2017
dmarcos pushed a commit to dmarcos/aframe that referenced this pull request Oct 18, 2017
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.

2 participants