Streamline brush settings

This commit is contained in:
Andras Schmelczer 2023-05-28 09:50:30 +01:00
commit 8eaee2fa65
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
7 changed files with 93 additions and 33 deletions

View file

@ -1,6 +1,6 @@
struct Settings {
brushWidth: f32,
brushWidthVariation: f32
brushSize: f32,
brushSizeVariation: f32
};
@group(1) @binding(0) var<uniform> settings: Settings;
@ -31,9 +31,9 @@ fn fragment(
) -> @location(0) vec4<f32> {
var distance = distanceFromLine(screenPosition, start, end);
let noise = textureSample(noise, noiseSampler, screenPosition / state.size / 50);
distance += noise.r * settings.brushWidthVariation;
distance += noise.r * settings.brushSizeVariation;
if(distance > settings.brushWidth) {
if(distance > settings.brushSize) {
discard;
}