Skip to content

Commit fc2dd13

Browse files
committed
Reset to original
1 parent 54ed78b commit fc2dd13

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

script.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,35 +206,35 @@ function supportRenderTextureFormat (gl, internalFormat, format, type) {
206206
}
207207

208208
function startGUI () {
209-
var gui = new dat.GUI({ width: 300 });
209+
var gui = new dat.GUI({ width: 350 });
210210
gui.add(config, 'DYE_RESOLUTION', { 'high': 1024, 'medium': 512, 'low': 256, 'very low': 128 }).name('quality').onFinishChange(initFramebuffers);
211211
gui.add(config, 'SIM_RESOLUTION', { '32': 32, '64': 64, '128': 128, '256': 256 }).name('sim resolution').onFinishChange(initFramebuffers);
212212
gui.add(config, 'DENSITY_DISSIPATION', 0, 4.0).name('density diffusion');
213213
gui.add(config, 'VELOCITY_DISSIPATION', 0, 4.0).name('velocity diffusion');
214214
gui.add(config, 'PRESSURE', 0.0, 1.0).name('pressure');
215215
gui.add(config, 'CURL', 0, 50).name('vorticity').step(1);
216216
gui.add(config, 'SPLAT_RADIUS', 0.01, 1.0).name('splat radius');
217-
gui.add(config, 'SHADING').name('shading').onFinishChange(updateKeywords);
218-
gui.add(config, 'COLORFUL').name('colorful');
219-
gui.add(config, 'PAUSED').name('paused').listen();
217+
gui.add(config, 'SHADING').name('shading [s]').onFinishChange(updateKeywords).listen();
218+
gui.add(config, 'COLORFUL').name('colorful [c]').listen();
219+
gui.add(config, 'PAUSED').name('paused [p]').listen();
220220

221221
gui.add({ fun: () => {
222222
splatStack.push(parseInt(Math.random() * 20) + 5);
223-
} }, 'fun').name('Random splats');
223+
} }, 'fun').name('Random splats [Space]');
224224

225225
let bloomFolder = gui.addFolder('Bloom');
226-
bloomFolder.add(config, 'BLOOM').name('enabled').onFinishChange(updateKeywords);
226+
bloomFolder.add(config, 'BLOOM').name('enabled [b]').onFinishChange(updateKeywords).listen();
227227
bloomFolder.add(config, 'BLOOM_INTENSITY', 0.1, 2.0).name('intensity');
228228
bloomFolder.add(config, 'BLOOM_THRESHOLD', 0.0, 1.0).name('threshold');
229229

230230
let sunraysFolder = gui.addFolder('Sunrays');
231-
sunraysFolder.add(config, 'SUNRAYS').name('enabled').onFinishChange(updateKeywords);
231+
sunraysFolder.add(config, 'SUNRAYS').name('enabled [r]').onFinishChange(updateKeywords).listen();
232232
sunraysFolder.add(config, 'SUNRAYS_WEIGHT', 0.3, 1.0).name('weight');
233233

234234
let captureFolder = gui.addFolder('Capture');
235235
captureFolder.addColor(config, 'BACK_COLOR').name('background color');
236236
captureFolder.add(config, 'TRANSPARENT').name('transparent');
237-
captureFolder.add({ fun: captureScreenshot }, 'fun').name('take screenshot');
237+
captureFolder.add({ fun: captureScreenshot }, 'fun').name('take screenshot [q]');
238238

239239
let github = gui.add({ fun : () => {
240240
window.open('https://github.com/PavelDoGreat/WebGL-Fluid-Simulation');
@@ -1519,6 +1519,16 @@ window.addEventListener('touchend', e => {
15191519
window.addEventListener('keydown', e => {
15201520
if (e.code === 'KeyP')
15211521
config.PAUSED = !config.PAUSED;
1522+
if (e.code === 'KeyS')
1523+
config.SHADING = !config.SHADING;
1524+
if (e.code === 'KeyC')
1525+
config.COLORFUL = !config.COLORFUL;
1526+
if (e.code === 'KeyB')
1527+
config.BLOOM = !config.BLOOM;
1528+
if (e.code === 'KeyR')
1529+
config.SUNRAYS = !config.SUNRAYS;
1530+
if (e.code === 'KeyQ')
1531+
captureScreenshot()
15221532
if (e.key === ' ')
15231533
splatStack.push(parseInt(Math.random() * 20) + 5);
15241534
});

0 commit comments

Comments
 (0)