add option SkinViewerOptions.alpha (true by default)

This commit is contained in:
Haowei Wen 2020-08-23 22:55:49 +08:00
parent d13eec6035
commit 8fbe59b155
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4
1 changed files with 5 additions and 1 deletions

View File

@ -15,6 +15,7 @@ export type SkinViewerOptions = {
height?: number;
skin?: RemoteImage | TextureSource;
cape?: RemoteImage | TextureSource;
alpha?: boolean;
}
function toMakeVisible(options?: LoadOptions): boolean {
@ -61,7 +62,10 @@ class SkinViewer {
this.camera.position.y = -12;
this.camera.position.z = 60;
this.renderer = new WebGLRenderer({ alpha: true, preserveDrawingBuffer: true });
this.renderer = new WebGLRenderer({
alpha: options.alpha !== false, // alpha is on by default
preserveDrawingBuffer: true
});
this.renderer.setPixelRatio(window.devicePixelRatio);
this.domElement.appendChild(this.renderer.domElement);