Use real time instead of fixed time steps
This commit is contained in:
@@ -78,7 +78,7 @@
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
float n = octavedPerlinNoise(vec3(gl_FragCoord.x*0.001,gl_FragCoord.y*0.007+uTime*0.1,uTime*0.05),8,2.0); //Should be scaled along arbitary axis
|
||||
float n = octavedPerlinNoise(vec3(gl_FragCoord.x*0.001,gl_FragCoord.y*0.007+uTime*0.0001,uTime*0.00005),8,2.0); //Should be scaled along arbitary axis
|
||||
//float n = noise(vec3(gl_FragCoord.xy*0.01,uTime));
|
||||
//vec3 cloudEffect = clouds(gl_FragCoord.x*0.005, gl_FragCoord.y*0.005);
|
||||
vec3 color = n + (vec3(1., 1., 1.)/2.);
|
||||
|
||||
@@ -138,10 +138,10 @@ var lastTime = new Date().getTime();
|
||||
var counter = 0.0;
|
||||
var fps = 0;
|
||||
function drawScene(buffer: WebGLBuffer, program: WebGLProgram) {
|
||||
timeSpent += 1.0 / 60.0;
|
||||
fps++;
|
||||
let now = new Date();
|
||||
let delta = now.getTime() - lastTime;
|
||||
timeSpent += delta;
|
||||
if ((counter += delta) >= 1000.) {
|
||||
counter = 0;
|
||||
console.log("FPS: " + fps);
|
||||
|
||||
Reference in New Issue
Block a user