-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
6 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,14 @@ import {ShaderPass} from "https://unpkg.com/[email protected]/examples/jsm/postproce | |
import {FXAAShader} from "https://unpkg.com/[email protected]/examples/jsm/shaders/FXAAShader.js"; | ||
import * as ModelUtils from "./ModelUtils.js"; | ||
|
||
function createRenderer(width, height, antialias) { | ||
function createRenderer(width, height, antialias, alpha) { | ||
// three.js expects a canvas, this fakes it lmfao | ||
const canvas = document.createElement("canvas"); | ||
|
||
const renderer = new THREE.WebGLRenderer({ | ||
canvas, | ||
antialias: antialias, | ||
alpha: alpha, | ||
powerPreference: "high-performance" | ||
}); | ||
|
||
|
@@ -31,8 +32,8 @@ function createRenderer(width, height, antialias) { | |
return renderer; | ||
} | ||
|
||
function drawScene(scene, camera, width, height, imageType, antialias) { | ||
const renderer = createRenderer(width, height, antialias); | ||
function drawScene(scene, camera, width, height, imageType, antialias, alpha) { | ||
const renderer = createRenderer(width, height, antialias, alpha); | ||
renderer.render(scene, camera); | ||
const frameBufferPixels = new Uint8Array(width * height * 4); | ||
const context = renderer.getContext(); | ||
|
@@ -102,6 +103,7 @@ class Scene { | |
if (options.canvas) { | ||
this.renderer = new THREE.WebGLRenderer({ | ||
canvas: options.canvas, | ||
alpha: options.alpha || false, | ||
powerPreference: "high-performance", | ||
antialias: true | ||
}); | ||
|