implement PPTY

This commit is contained in:
do butterflies cry? 2026-02-03 20:26:22 +10:00
parent a13032c76e
commit d76ac04531
12 changed files with 499 additions and 118 deletions

View file

@ -1,4 +1,14 @@
import { Smc } from "./smc.js";
import { SmcErr } from "./errors.js";
export { Smc, SmcErr };
export { Smc, SmcErr, fetchShader };
async function fetchShader(uri, delegate) {
const res = await fetch(uri);
if (res.ok)
return await res.text();
this.raiseError(
SmcErr.FETCH_SHADER,
`Failed to load shader source ${url}: ${res.status} ${res.json()}`);
return ""
}

View file

@ -164,10 +164,11 @@ class Smc {
var delta = time - this.#prevTimeMs;
this.render(time, delta);
setTimeout(
() => requestAnimationFrame(this.renderLoop),
Math.max(0, delta - this.#minDeltaTimeMs)
);
requestAnimationFrame(this.renderLoop);
// setTimeout(
// () => requestAnimationFrame(this.renderLoop),
// Math.max(0, delta - this.#minDeltaTimeMs)
// );
this.#prevTimeMs = time;
}