global timing source
This commit is contained in:
parent
0043f3ae51
commit
8a42f36ddc
2 changed files with 13 additions and 8 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue