Spaces:
Running
Running
File size: 1,091 Bytes
d13e19f 9905bd0 1cc5c8d 9905bd0 41fe030 9905bd0 41fe030 9905bd0 ffea1eb 9905bd0 ffea1eb 480409f 9905bd0 d13e19f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
export function createState(config) {
return {
webgpu: {
device: null,
pipeline: null,
vertexBuffer: null,
indexBuffer: null,
uniformBuffer: null,
texture: null,
sampler: null,
bindGroup: null,
context: null,
presentationFormat: null,
shaderCode: null,
},
matrices: {
uniformValues: new Float32Array(config.floatsInUniformBuffer),
matrix: new Float32Array(config.matrixSize),
},
glyphs: {
numGlyphs: 0,
width: 0,
height: 0,
},
canvas: document.querySelector('canvas') || document.body.appendChild(document.createElement('canvas')),
timing: {
time: 0,
fixedDeltaTime: 0,
maxFrameTime: 0,
targetFps: 0,
frameDuration: 0,
accumulator: 0,
deltaTime: 0,
currentTime: 0,
frameTime: 0,
lastTime: 0,
}
};
}
|