Rename settings
This commit is contained in:
parent
d83d5a8d4f
commit
3084ede26d
7 changed files with 32 additions and 34 deletions
|
|
@ -119,11 +119,11 @@ export class BrushPipeline {
|
|||
this.linePoints.length = 0;
|
||||
}
|
||||
|
||||
public setParameters({ brushWidth, brushWidthRandomness }: BrushSettings) {
|
||||
public setParameters({ brushWidth, brushWidthVariation }: BrushSettings) {
|
||||
this.device.queue.writeBuffer(
|
||||
this.uniforms,
|
||||
0,
|
||||
new Float32Array([brushWidth / 2, (brushWidth / 2) * brushWidthRandomness])
|
||||
new Float32Array([brushWidth / 2, (brushWidth / 2) * brushWidthVariation])
|
||||
);
|
||||
|
||||
this.actualPoints = this.linePoints.slice();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export interface BrushSettings {
|
||||
brushWidth: number;
|
||||
brushWidthRandomness: number;
|
||||
brushWidthVariation: number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
struct Settings {
|
||||
brushWidth: f32,
|
||||
brushWidthRandomness: f32
|
||||
brushWidthVariation: f32
|
||||
};
|
||||
|
||||
@group(1) @binding(0) var<uniform> settings: Settings;
|
||||
|
|
@ -31,7 +31,7 @@ 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.brushWidthRandomness;
|
||||
distance += noise.r * settings.brushWidthVariation;
|
||||
|
||||
if(distance > settings.brushWidth) {
|
||||
discard;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue