global timing source

This commit is contained in:
41666 2023-10-01 12:00:31 -04:00
parent 0043f3ae51
commit 8a42f36ddc
2 changed files with 13 additions and 8 deletions

View file

@ -3,7 +3,6 @@ export class Shader {
this.gl = app.gl;
this.app = app;
this.program = this.gl.createProgram();
this.startTime = Date.now();
}
attach(type, source) {
@ -49,8 +48,7 @@ export class Shader {
}
updateTime() {
const now = Date.now();
const time = now - this.startTime;
const time = this.app.now();
const sinTime = Math.sin(time);
const cosTime = Math.cos(time);
this.gl.uniform1f(this.location("uTime"), time);