Add tiny UI
This commit is contained in:
parent
e3d0af56e2
commit
6a752a57e9
30 changed files with 627 additions and 210 deletions
|
|
@ -29,15 +29,14 @@ fn fragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
|
|||
let mixedTrails = mix(
|
||||
current.rgb,
|
||||
neighbours.rgb,
|
||||
settings.diffusionRateTrails + (noise.rgb - vec3(0.5)) * 0.1
|
||||
settings.diffusionRateTrails
|
||||
) * (1.0 - settings.decayRateTrails);
|
||||
|
||||
let mixedBrush = mix(
|
||||
current.a,
|
||||
neighbours.a,
|
||||
settings.diffusionRateBrush + (noise.a - 0.5) * 0.5
|
||||
) * (1.0 - settings.decayRateBrush - (noise.a - 0.5) * 0.1);
|
||||
|
||||
current.a + (noise.a - 0.5) * 0.1,
|
||||
neighbours.a ,
|
||||
settings.diffusionRateBrush
|
||||
) * (1.0 - settings.decayRateBrush);
|
||||
|
||||
return clamp(vec4(mixedTrails, mixedBrush), vec4(0), vec4(1));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { setUpFullScreenQuad } from '../../utils/graphics/full-screen-quad/full-screen-quad';
|
||||
import { generateNoise } from '../../utils/graphics/noise/noise';
|
||||
import { smartCompile } from '../../utils/smart-compile';
|
||||
import { smartCompile } from '../../utils/webgpu/smart-compile';
|
||||
import { CommonParameters } from '../common-parameters';
|
||||
import shader from './diffuse.wgsl';
|
||||
import { DiffusionSettings } from './diffusion-settings';
|
||||
|
|
@ -11,7 +11,7 @@ export class DiffusionPipeline {
|
|||
private readonly pipeline: GPURenderPipeline;
|
||||
private readonly uniforms: GPUBuffer;
|
||||
private readonly quadVertexBuffer: GPUBuffer;
|
||||
private readonly noise: GPUTexture;
|
||||
private readonly noise: GPUTextureView;
|
||||
|
||||
private bindGroup?: GPUBindGroup;
|
||||
private previousTrailMapIn?: GPUTexture;
|
||||
|
|
@ -128,7 +128,7 @@ export class DiffusionPipeline {
|
|||
},
|
||||
{
|
||||
binding: 3,
|
||||
resource: this.noise.createView(),
|
||||
resource: this.noise,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
@ -136,4 +136,9 @@ export class DiffusionPipeline {
|
|||
this.previousTrailMapIn = trailMapIn;
|
||||
}
|
||||
}
|
||||
|
||||
public destroy() {
|
||||
this.quadVertexBuffer.destroy();
|
||||
this.uniforms.destroy();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue