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

Add OffscreenCanvas support for extractThumbnailBlob #511

Merged
merged 2 commits into from
Oct 26, 2020
Merged

Conversation

JLChnToZ
Copy link
Contributor

fixes #508

@0b5vr 0b5vr self-requested a review October 26, 2020 08:14
@0b5vr 0b5vr added the enhancement New feature or request label Oct 26, 2020
@0b5vr 0b5vr added this to the next milestone Oct 26, 2020
// store the current resolution
renderer.getSize(_v2A);
const prevWidth = _v2A.x;
const prevHeight = _v2A.y;

// overwrite the resolution
renderer.setSize(size, size);
renderer.setSize(size, size, !(canvas instanceof OffscreenCanvas));
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh! I didn't know the third argument of setSize is true by default.

There is no reason resizing the style in this function, could you set false here instead? I also want to change revert to previous resolution one of course.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean all renderer.setSize() in this method do not need to updateStyle?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes

@0b5vr
Copy link
Contributor

0b5vr commented Oct 26, 2020

I've never used offscreen canvas before but let me try this in this opportunity...

@0b5vr
Copy link
Contributor

0b5vr commented Oct 26, 2020

It worked perfectly!

@JLChnToZ JLChnToZ requested a review from 0b5vr October 26, 2020 08:34
@0b5vr
Copy link
Contributor

0b5vr commented Oct 26, 2020

uhhhh I just have noticed that the resize applies to the screen buffer for several frames since canvas.toBlob is asynchronous @ examples/meta.html ......
I don't think we should address to this in this branch but I'll think something against the issue.

@0b5vr
Copy link
Contributor

0b5vr commented Oct 26, 2020

Anyway it looks excellent for me, thanks again! merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VRMUtils.extractThumbnailBlob does not work with OffscreenCanvas backed WebGLRenderer
2 participants