Update helpers
This commit is contained in:
parent
12fa81c3ed
commit
a76b515b80
4 changed files with 18 additions and 7 deletions
|
|
@ -11,7 +11,6 @@ const setIndexAlias = (name: string, index: number, type: any) => {
|
|||
}
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export const applyArrayPlugins = () => {
|
||||
setIndexAlias('x', 0, Array);
|
||||
setIndexAlias('y', 1, Array);
|
||||
|
|
|
|||
17
src/utils/graphics/initialize-context.ts
Normal file
17
src/utils/graphics/initialize-context.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
export const initializeContext = ({
|
||||
device,
|
||||
canvas,
|
||||
}: {
|
||||
device: GPUDevice;
|
||||
canvas: HTMLCanvasElement;
|
||||
}): GPUCanvasContext => {
|
||||
const context = canvas.getContext('webgpu') as any as GPUCanvasContext;
|
||||
|
||||
context.configure({
|
||||
device: device,
|
||||
format: navigator.gpu.getPreferredCanvasFormat(),
|
||||
alphaMode: 'premultiplied',
|
||||
});
|
||||
|
||||
return context;
|
||||
};
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
export const prettyPrint = (o: any): string =>
|
||||
JSON.stringify(o, (_, v) => (v?.toFixed ? Number(v.toFixed(3)) : v), ' ')
|
||||
.replace(/("|,|{|^\n)/g, '')
|
||||
.replace(/(\W*}\n?)+/g, '\n\n');
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
export abstract class Random {
|
||||
// https://stackoverflow.com/questions/521295/seeding-the-random-number-generator-in-javascript, Mulberry32
|
||||
|
||||
export abstract class Random {
|
||||
private static _seed = 42;
|
||||
|
||||
public static set seed(value: number) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue