Merge pull request #74 from bs-community/manual-preserveDrawingBuffer

add 'preserveDrawingBuffer' option
This commit is contained in:
Haowei Wen 2020-09-09 20:26:41 +08:00 committed by GitHub
commit 3aa66bfae0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -27,6 +27,11 @@ export type SkinViewerOptions = {
* A new canvas is created if this parameter is unspecified.
*/
canvas?: HTMLCanvasElement;
/**
* Whether to preserve the buffers until manually cleared or overwritten. Default is false.
*/
preserveDrawingBuffer?: boolean;
}
function toMakeVisible(options?: LoadOptions): boolean {
@ -75,8 +80,9 @@ class SkinViewer {
this.renderer = new WebGLRenderer({
canvas: this.canvas,
alpha: options.alpha !== false, // alpha is on by default
preserveDrawingBuffer: true
alpha: options.alpha !== false, // default: true
preserveDrawingBuffer: options.preserveDrawingBuffer === true // default: false
});
this.renderer.setPixelRatio(window.devicePixelRatio);