mirror of
https://github.com/PavelDoGreat/WebGL-Fluid-Simulation.git
synced 2025-10-03 17:31:53 +02:00
little refactoring
This commit is contained in:
10
script.js
10
script.js
@@ -127,10 +127,6 @@ const displayShader = compileShader(gl.FRAGMENT_SHADER, `
|
|||||||
precision mediump sampler2D;
|
precision mediump sampler2D;
|
||||||
|
|
||||||
varying vec2 vUv;
|
varying vec2 vUv;
|
||||||
varying vec2 vL;
|
|
||||||
varying vec2 vR;
|
|
||||||
varying vec2 vT;
|
|
||||||
varying vec2 vB;
|
|
||||||
uniform sampler2D uTexture;
|
uniform sampler2D uTexture;
|
||||||
|
|
||||||
void main () {
|
void main () {
|
||||||
@@ -458,9 +454,9 @@ for (let i = 0; i < 10; i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let lastTime = Date.now();
|
let lastTime = Date.now();
|
||||||
Update();
|
update();
|
||||||
|
|
||||||
function Update () {
|
function update () {
|
||||||
resizeCanvas();
|
resizeCanvas();
|
||||||
|
|
||||||
const dt = Math.min((Date.now() - lastTime) / 1000, 0.016);
|
const dt = Math.min((Date.now() - lastTime) / 1000, 0.016);
|
||||||
@@ -537,7 +533,7 @@ function Update () {
|
|||||||
gl.uniform1i(displayProgram.uniforms.uTexture, density.first[2]);
|
gl.uniform1i(displayProgram.uniforms.uTexture, density.first[2]);
|
||||||
blit(null);
|
blit(null);
|
||||||
|
|
||||||
requestAnimationFrame(Update);
|
requestAnimationFrame(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
function splat (x, y, dx, dy, color) {
|
function splat (x, y, dx, dy, color) {
|
||||||
|
Reference in New Issue
Block a user