mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-17 05:49:30 -07:00
Double click now toggles full screen. Delayed initializing regl until the camera is set up, so its start time comes after the visitor closes the browser prompt
This commit is contained in:
@@ -44,21 +44,25 @@ export default async (canvas, config) => {
|
||||
canvas.height = Math.ceil(canvas.clientHeight * config.resolution);
|
||||
};
|
||||
window.onresize = resize;
|
||||
// if (document.fullscreenEnabled || document.webkitFullscreenEnabled) {
|
||||
// window.onclick = () => {
|
||||
// if (document.fullscreenElement == null) {
|
||||
// if (canvas.webkitRequestFullscreen != null) {
|
||||
// canvas.webkitRequestFullscreen();
|
||||
// } else {
|
||||
// canvas.requestFullscreen();
|
||||
// }
|
||||
// } else {
|
||||
// document.exitFullscreen();
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
if (document.fullscreenEnabled || document.webkitFullscreenEnabled) {
|
||||
window.ondblclick = () => {
|
||||
if (document.fullscreenElement == null) {
|
||||
if (canvas.webkitRequestFullscreen != null) {
|
||||
canvas.webkitRequestFullscreen();
|
||||
} else {
|
||||
canvas.requestFullscreen();
|
||||
}
|
||||
} else {
|
||||
document.exitFullscreen();
|
||||
}
|
||||
};
|
||||
}
|
||||
resize();
|
||||
|
||||
if (config.useCamera) {
|
||||
await setupCamera();
|
||||
}
|
||||
|
||||
const regl = createREGL({
|
||||
canvas,
|
||||
extensions: ["OES_texture_half_float", "OES_texture_half_float_linear"],
|
||||
@@ -68,10 +72,6 @@ export default async (canvas, config) => {
|
||||
|
||||
const lkg = await getLKG(config.useHoloplay, true);
|
||||
|
||||
if (config.useCamera) {
|
||||
await setupCamera();
|
||||
}
|
||||
|
||||
// All this takes place in a full screen quad.
|
||||
const fullScreenQuad = makeFullScreenQuad(regl);
|
||||
const effectName = config.effect in effects ? config.effect : "plain";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { loadImage, loadText, makePassFBO, makePass } from "./utils.js";
|
||||
import { cameraCanvas, cameraAspectRatio } from "../camera.js";
|
||||
|
||||
let start = Date.now();
|
||||
let start;
|
||||
const numClicks = 5;
|
||||
const clicks = Array(numClicks).fill([0, 0, -Infinity]).flat();
|
||||
let aspectRatio = 1;
|
||||
@@ -18,8 +18,6 @@ export default ({ regl, config }, inputs) => {
|
||||
|
||||
const cameraTex = regl.texture(cameraCanvas);
|
||||
|
||||
start = Date.now();
|
||||
|
||||
const output = makePassFBO(regl, config.useHalfFloat);
|
||||
const mirrorPassFrag = loadText("shaders/glsl/mirrorPass.frag.glsl");
|
||||
const render = regl({
|
||||
@@ -35,6 +33,9 @@ export default ({ regl, config }, inputs) => {
|
||||
},
|
||||
framebuffer: output,
|
||||
});
|
||||
|
||||
start = Date.now();
|
||||
|
||||
return makePass(
|
||||
{
|
||||
primary: output,
|
||||
|
||||
Reference in New Issue
Block a user