Camera input and mirror effect now also work in WebGPU. Added the "once" parameter, which renders a single frame. Fixed bugs in gpu-buffer.

This commit is contained in:
Rezmason
2022-08-11 00:08:05 -07:00
parent fc6821f4db
commit 3da3db61f1
10 changed files with 241 additions and 20 deletions

View File

@@ -6,6 +6,7 @@ cameraCanvas.width = 1;
cameraCanvas.height = 1;
const context = cameraCanvas.getContext("2d");
let cameraAspectRatio = 1.0;
const cameraSize = [1, 1];
const drawToCanvas = () => {
requestAnimationFrame(drawToCanvas);
@@ -29,6 +30,8 @@ const setupCamera = async () => {
cameraCanvas.width = width;
cameraCanvas.height = height;
cameraAspectRatio = width / height;
cameraSize[0] = width;
cameraSize[1] = height;
video.srcObject = stream;
video.play();
@@ -39,4 +42,4 @@ const setupCamera = async () => {
}
};
export { cameraCanvas, cameraAspectRatio, setupCamera };
export { cameraCanvas, cameraAspectRatio, cameraSize, setupCamera };