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

Cleaned up VR implementation #76

Merged
merged 8 commits into from Apr 3, 2018
Merged

Cleaned up VR implementation #76

merged 8 commits into from Apr 3, 2018

Conversation

@Manishearth
Copy link
Member

Manishearth commented Mar 10, 2018

Fixed up https://github.com/pcwalton/pathfinder/pull/75

Actually mergeable.

I still want to improve the camera code. It currently just overwrites the rotation matrix, but we can do better.

Ideally the code gets refactored into having two view transforms.

r? @pcwalton

@Manishearth Manishearth force-pushed the Manishearth:vr-better branch 2 times, most recently from 478dbbe to b57a7dd Mar 20, 2018
Copy link
Collaborator

pcwalton left a comment

Looks good, just needs a few stylistic changes. Thanks for working on this!

@@ -146,7 +146,9 @@ export abstract class Renderer {
this.clearDestFramebuffer();

// Start timing rendering.
if (this.timerQueryPollInterval == null) {
if (this.timerQueryPollInterval == null &&

This comment has been minimized.

@pcwalton

pcwalton Mar 25, 2018

Collaborator

The entire commit that makes timer queries optional shouldn't be necessary now since I made this change right before showing my slides at the Rust meetup.

class="btn btn-outline-secondary pf-toolbar-button"
aria-expanded="false" aria-controls="#pf-vr"
style="display: none">
<span>VR</span>

This comment has been minimized.

@pcwalton

pcwalton Mar 25, 2018

Collaborator

Note to self: we use Material Design Icons here and there is a VR icon, so let's use that.

This comment has been minimized.

@Manishearth

Manishearth Mar 25, 2018

Author Member

huh, I looked for one and didn't find it. Will look again

This comment has been minimized.

@@ -174,6 +175,10 @@ export abstract class DemoView extends PathfinderView implements RenderContext {
protected colorBufferHalfFloatExt: any;

private wantsScreenshot: boolean;
private vrDisplay: VRDisplay | null;

This comment has been minimized.

@pcwalton

pcwalton Mar 25, 2018

Collaborator

nit: can you put a newline above this? Let's keep all the VR-specific stuff together.

if ("VRFrameData" in window) {
this.vrFrameData = new VRFrameData;
} else {
this.vrFrameData = null;

This comment has been minimized.

@pcwalton

pcwalton Mar 25, 2018

Collaborator

nit: weird indentation here

}

vrSetup(): void {
if (navigator.getVRDisplays) {

This comment has been minimized.

@pcwalton

pcwalton Mar 25, 2018

Collaborator

nit: Let's use if ('getVRDisplays' in navigator) { ... } for consistency with the above.

@@ -25,22 +25,28 @@ uniform float uShininess;
/// The normal of these vertices.
uniform vec3 uNormal;

uniform bool uLightThings;

This comment has been minimized.

@pcwalton

pcwalton Mar 25, 2018

Collaborator

Cute name, but I think that uEnableLighting might be more obvious :)

if ("VRFrameData" in window) {
this.vrFrameData = new VRFrameData;
} else {
this.vrFrameData = null;

This comment has been minimized.

@pcwalton

pcwalton Mar 25, 2018

Collaborator

nit: weird indentation

});
} else {
// no vr support
}

This comment has been minimized.

@pcwalton

pcwalton Mar 25, 2018

Collaborator

Stylistic comments left on the earlier version of this function apply here too.

@@ -149,6 +149,9 @@ export abstract class Renderer {
gl.viewport(0, 0, this.destAllocatedSize[0], this.destAllocatedSize[1]);
}

setClipPlanes(display: VRDisplay) {

This comment has been minimized.

@pcwalton

pcwalton Mar 25, 2018

Collaborator

Why this function? (Also needs a return type annotation.)

this.inVRRAF = true;
this.redraw();
this.inVRRAF = false;
};

This comment has been minimized.

@pcwalton

pcwalton Mar 25, 2018

Collaborator

Ah, I see you made the arrow function change. Disregard the previous comments then :)

@Manishearth
Copy link
Member Author

Manishearth commented Mar 26, 2018

addressed

@pcwalton
Copy link
Collaborator

pcwalton commented Mar 26, 2018

@pcwalton
Copy link
Collaborator

pcwalton commented Mar 26, 2018

(Note that this still has merge conflicts just as a reminder)

@Manishearth Manishearth force-pushed the Manishearth:vr-better branch from 7600a2e to cbf334e Mar 26, 2018
@Manishearth
Copy link
Member Author

Manishearth commented Mar 26, 2018

pushed. I'll fix the icon later, seems to be trickier since it's not in the font and I'll have to size it myself (and it's late)

@Manishearth
Copy link
Member Author

Manishearth commented Mar 29, 2018

Okay -- so I looked into it; that icon is only in the fonts provided on https://materialdesignicons.com/getting-started , however these work a completely different way; they don't work by ligaturifying the right text. Instead, they use a bunch of CSS with ::before attributes being used with Private Use codepoints.

I'm not sure if we should switch to that model, seems tricky to style.

@pcwalton
Copy link
Collaborator

pcwalton commented Mar 29, 2018

@Manishearth
Copy link
Member Author

Manishearth commented Apr 2, 2018

Pushed. It's hard to get it at the same size, but it's close enough.

@pcwalton
Copy link
Collaborator

pcwalton commented Apr 3, 2018

Looks good, squash into a few commits and let's get it merged :)

@Manishearth Manishearth force-pushed the Manishearth:vr-better branch from e6c7a76 to 8ed4e96 Apr 3, 2018
@Manishearth
Copy link
Member Author

Manishearth commented Apr 3, 2018

Squashed the fixups, kept the main commits so that it's easy to read.

@pcwalton pcwalton merged commit 6f839cd into servo:master Apr 3, 2018
@pcwalton
Copy link
Collaborator

pcwalton commented Apr 3, 2018

Merged!

@Manishearth Manishearth deleted the Manishearth:vr-better branch Apr 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.