// import { BufferGeometry } from 'three';
// import * as BufferGeometryUtils from 'three/examples/jsm/utils/BufferGeometryUtils.js';


export function getParam(name: string) {
    const urlParams = new URLSearchParams(window.location.search);
    const param = urlParams.get(name);
    if (param == null || param === "0" || param === "false") return false;
    if (param === "") return true;
    return param;
}

export const debug = getParam("debugmaterialx");
export const debugUpdate = debug === "update";


let time = 0;
export function getTime() {
    return time;
}
let frame = 0;
export function getFrame() {
    return frame;
}

const performance = window.performance || (window as any).webkitPerformance || (window as any).mozPerformance;
function updateTime() {
    time = performance.now() / 1000; // Convert to seconds
    frame++;
    window.requestAnimationFrame(updateTime);
}
window.requestAnimationFrame(updateTime);

