Move files

This commit is contained in:
Andras Schmelczer 2023-05-28 10:01:11 +01:00
parent 77e2013961
commit 339862a6ac
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
14 changed files with 23 additions and 48 deletions

View file

@ -1,5 +1,5 @@
import { settings } from '../settings';
import { hsl } from '../utils/colors/hsl';
import { hsl } from '../utils/hsl';
import { last } from '../utils/last';
import { Random } from '../utils/random';

View file

@ -1,5 +1,5 @@
import { settings } from '../settings';
import { SettingsSlider, ValueScaling } from '../utils/settings-slider';
import { SettingsSlider, ValueScaling } from './settings-slider';
export const setUpSettingsPage = (
settingsPage: HTMLDivElement,

View file

@ -1,4 +1,4 @@
import { formatNumber } from './format-number';
import { formatNumber } from '../utils/format-number';
export enum ValueScaling {
Linear,

View file

@ -1,4 +1,4 @@
import { setUpFullScreenQuad } from '../../utils/graphics/full-screen-quad/full-screen-quad';
import { setUpFullScreenQuad } from '../../utils/graphics/full-screen-quad';
import { smartCompile } from '../../utils/graphics/smart-compile';
import { CommonState } from '../common-state/common-state';
import shader from './diffuse.wgsl';

View file

@ -1,4 +1,4 @@
import { setUpFullScreenQuad } from '../../utils/graphics/full-screen-quad/full-screen-quad';
import { setUpFullScreenQuad } from '../../utils/graphics/full-screen-quad';
import { smartCompile } from '../../utils/graphics/smart-compile';
import { CommonState } from '../common-state/common-state';
import { RenderSettings } from './render-settings';

View file

@ -1,16 +0,0 @@
import { rgb255 } from './rgb255';
import { vec3 } from 'gl-matrix';
export const hex = (hex: string): vec3 => {
if (hex[0] === '#') {
hex = hex.slice(1);
}
const bigint = parseInt(hex, 16);
const r = (bigint >> 16) & 255;
const g = (bigint >> 8) & 255;
const b = bigint & 255;
return rgb255(r, g, b);
};

View file

@ -1,4 +0,0 @@
import { vec3 } from 'gl-matrix';
export const rgb255 = (r: number, g: number, b: number): vec3 =>
vec3.fromValues(r / 255, g / 255, b / 255);

View file

@ -1,4 +0,0 @@
import { vec4 } from 'gl-matrix';
export const rgba = (r: number, g: number, b: number, a: number): vec4 =>
vec4.fromValues(r, g, b, a);

View file

@ -1,4 +0,0 @@
import { vec4 } from 'gl-matrix';
export const rgba255 = (r: number, g: number, b: number, a: number): vec4 =>
vec4.fromValues(r / 255, g / 255, b / 255, a / 255);

View file

@ -1,5 +1,5 @@
import { smartCompile } from '../smart-compile';
import shader from './full-screen-quad.wgsl';
import { smartCompile } from './smart-compile';
export const setUpFullScreenQuad = (
device: GPUDevice
@ -26,7 +26,22 @@ export const setUpFullScreenQuad = (
return {
buffer,
vertex: {
module: smartCompile(device, shader),
module: smartCompile(
device,
/* wgsl */ `
struct VertexOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv: vec2<f32>,
}
@vertex
fn vertex(
@location(0) position: vec2<f32>,
@location(1) uv: vec2<f32>
) -> VertexOutput {
return VertexOutput(vec4(position, 0.0, 1.0), uv);
}`
),
entryPoint: 'vertex',
buffers: [
{

View file

@ -1,12 +0,0 @@
struct VertexOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv: vec2<f32>,
}
@vertex
fn vertex(
@location(0) position: vec2<f32>,
@location(1) uv: vec2<f32>
) -> VertexOutput {
return VertexOutput(vec4(position, 0.0, 1.0), uv);
}

View file

@ -1,4 +1,4 @@
import { setUpFullScreenQuad } from './full-screen-quad/full-screen-quad';
import { setUpFullScreenQuad } from './full-screen-quad';
import { smartCompile } from './smart-compile';
const textureCache = new Map<string, GPUTexture>();