Spaces:
Running
Running
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, | |
} | |
}; | |
} | |