Clean up configs
This commit is contained in:
parent
79638d5fa4
commit
0fddad6b45
36 changed files with 375 additions and 652 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
|
||||
import { appConfig } from '../../config';
|
||||
import { getRenderQualityBrushSize } from '../../config/brush-size';
|
||||
import {
|
||||
createCachedBufferWrite,
|
||||
|
|
@ -40,6 +39,7 @@ export const getSafePixelRatio = (pixelRatio: number | undefined): number =>
|
|||
: 1;
|
||||
|
||||
const UNIFORM_COUNT = 16;
|
||||
const MAX_BRUSH_LINE_COUNT = 240;
|
||||
|
||||
const setBrushUniformValues = (
|
||||
target: Float32Array,
|
||||
|
|
@ -93,7 +93,7 @@ export class BrushPipeline {
|
|||
private readonly device: GPUDevice,
|
||||
private readonly commonState: CommonState
|
||||
) {
|
||||
this.segments = new LineSegmentBuffer(device, appConfig.pipelines.brush.maxLineCount);
|
||||
this.segments = new LineSegmentBuffer(device, MAX_BRUSH_LINE_COUNT);
|
||||
|
||||
this.bindGroupLayout = device.createBindGroupLayout({
|
||||
entries: [
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
|
||||
import { appConfig } from '../../config';
|
||||
import {
|
||||
createCachedBufferWrite,
|
||||
writeBufferIfChanged,
|
||||
} from '../../utils/graphics/cached-buffer-write';
|
||||
import { generateNoise } from '../../utils/graphics/noise';
|
||||
import { generateNoise, NOISE_TEXTURE_SIZE } from '../../utils/graphics/noise';
|
||||
|
||||
export class CommonState {
|
||||
private static readonly UNIFORM_COUNT = 4;
|
||||
|
|
@ -39,8 +38,8 @@ export class CommonState {
|
|||
|
||||
const noise = generateNoise({
|
||||
device,
|
||||
width: appConfig.pipelines.common.noiseTextureSize,
|
||||
height: appConfig.pipelines.common.noiseTextureSize,
|
||||
width: NOISE_TEXTURE_SIZE,
|
||||
height: NOISE_TEXTURE_SIZE,
|
||||
});
|
||||
this.noise = noise.texture;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
|
||||
import { appConfig } from '../../config';
|
||||
import { createBindGroupCache } from '../../utils/graphics/bind-group-cache';
|
||||
import {
|
||||
createCachedBufferWrite,
|
||||
|
|
@ -29,12 +28,13 @@ type DiffusionUniformSettings = Pick<
|
|||
| 'brushDecayAlphaOffset'
|
||||
>;
|
||||
|
||||
const MIN_DIFFUSION_RATE = 0.000001;
|
||||
|
||||
const getSafeInverseDiffusionRate = (diffusionRate: number): number =>
|
||||
1 /
|
||||
(Number.isFinite(diffusionRate) &&
|
||||
diffusionRate > appConfig.pipelines.diffusion.minDiffusionRate
|
||||
(Number.isFinite(diffusionRate) && diffusionRate > MIN_DIFFUSION_RATE
|
||||
? diffusionRate
|
||||
: appConfig.pipelines.diffusion.minDiffusionRate);
|
||||
: MIN_DIFFUSION_RATE);
|
||||
|
||||
const setDiffusionUniformValues = (
|
||||
target: Float32Array,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
|
||||
import { appConfig } from '../../config';
|
||||
import {
|
||||
createCachedBufferWrite,
|
||||
writeBufferIfChanged,
|
||||
|
|
@ -29,6 +28,7 @@ interface EraserTextureParameters {
|
|||
}
|
||||
|
||||
const UNIFORM_COUNT = 8;
|
||||
const MAX_ERASER_TEXTURE_LINE_COUNT = 384;
|
||||
const TARGET_FORMATS: Array<GPUTextureFormat> = [
|
||||
ERASER_MASK_TEXTURE_FORMAT,
|
||||
TRAIL_SOURCE_TEXTURE_FORMAT,
|
||||
|
|
@ -50,10 +50,7 @@ export class EraserTexturePipeline {
|
|||
private readonly device: GPUDevice,
|
||||
private readonly commonState: CommonState
|
||||
) {
|
||||
this.segments = new LineSegmentBuffer(
|
||||
device,
|
||||
appConfig.pipelines.eraser.maxTextureLineCount
|
||||
);
|
||||
this.segments = new LineSegmentBuffer(device, MAX_ERASER_TEXTURE_LINE_COUNT);
|
||||
|
||||
this.bindGroupLayout = device.createBindGroupLayout({
|
||||
entries: [
|
||||
|
|
|
|||
Loading…
Reference in a new issue