Various improvements
This commit is contained in:
parent
488494634d
commit
abf3803cdc
15 changed files with 259 additions and 226 deletions
|
|
@ -7,5 +7,5 @@ export const formatNumber = (value: number, unit = ''): string => {
|
|||
return `${(value / 1e3).toFixed(1)} thousand ${unit}`;
|
||||
}
|
||||
|
||||
return `${value === Math.floor(value) ? value : value.toFixed(2)}${unit}`;
|
||||
return `${value === Math.floor(value) ? value : value.toFixed(2)} ${unit}`;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import shader from './full-screen-quad.wgsl';
|
||||
import { smartCompile } from './smart-compile';
|
||||
|
||||
export const setUpFullScreenQuad = (
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ const textureCache = new Map<string, GPUTexture>();
|
|||
|
||||
export const generateNoise = ({
|
||||
device,
|
||||
width = 1024,
|
||||
height = 1024,
|
||||
width,
|
||||
height,
|
||||
}: {
|
||||
device: GPUDevice;
|
||||
width?: number;
|
||||
height?: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}): GPUTextureView => {
|
||||
const cacheKey = `${width}x${height}`;
|
||||
if (!textureCache.has(cacheKey)) {
|
||||
|
|
@ -31,10 +31,10 @@ export const generateNoise = ({
|
|||
@fragment
|
||||
fn fragment(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
|
||||
return vec4(
|
||||
random_with_seed(uv, 0),
|
||||
random_with_seed(uv, 1),
|
||||
random_with_seed(uv, 2),
|
||||
random_with_seed(uv, 3),
|
||||
random_with_seed(uv, 4),
|
||||
);
|
||||
}`
|
||||
),
|
||||
|
|
|
|||
|
|
@ -20,12 +20,9 @@ export class ResizableTexture {
|
|||
|
||||
const newTexture = this.device.createTexture({
|
||||
format: 'rgba16float',
|
||||
dimension: '2d',
|
||||
mipLevelCount: 1,
|
||||
size: {
|
||||
width: size.x,
|
||||
height: size.y,
|
||||
depthOrArrayLayers: 1,
|
||||
},
|
||||
usage:
|
||||
GPUTextureUsage.STORAGE_BINDING |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue