diff --git a/client/speed.js b/client/speed.js index 0db8319..70c5098 100644 --- a/client/speed.js +++ b/client/speed.js @@ -65,27 +65,28 @@ async function init_wasm(state) { state.wasm.buffers = { 'xs': { - 'offset': state.wasm.exports.alloc_static(initial), 'used': 0, 'cap': initial }, 'ys': { - 'offset': state.wasm.exports.alloc_static(initial), 'used': 0, 'cap': initial }, 'coords_from': { - 'offset': state.wasm.exports.alloc_static(initial), 'used': 0, 'cap': initial }, 'pressures': { - 'offset': state.wasm.exports.alloc_static(initial), 'used': 0, 'cap': initial }, }; + state.wasm.buffers['xs'].offset = state.wasm.exports.alloc_static(initial); + state.wasm.buffers['ys'].offset = state.wasm.exports.alloc_static(initial); + state.wasm.buffers['pressures'].offset = state.wasm.exports.alloc_static(initial); + state.wasm.buffers['coords_from'].offset = state.wasm.exports.alloc_static(initial); + const mem = state.wasm.memory.buffer; state.wasm.buffers['xs'].tv = tv_create_on(Float32Array, initial / 4, diff --git a/client/webgl_draw.js b/client/webgl_draw.js index 75ffea7..f3610cd 100644 --- a/client/webgl_draw.js +++ b/client/webgl_draw.js @@ -323,6 +323,14 @@ async function draw(state, context, animate, ts) { gl.bindTexture(gl.TEXTURE_2D, context.textures['dynamic_stroke_data']); upload_square_rgba16ui_texture(gl, context.dynamic_stroke_data, config.dynamic_stroke_texture_size); + gl.uniform2f(locations['u_res'], context.canvas.width, context.canvas.height); + gl.uniform2f(locations['u_scale'], state.canvas.zoom, state.canvas.zoom); + gl.uniform2f(locations['u_translation'], state.canvas.offset.x, state.canvas.offset.y); + gl.uniform1i(locations['u_stroke_count'], context.dynamic_stroke_count); + gl.uniform1i(locations['u_debug_mode'], state.debug.red); + gl.uniform1i(locations['u_stroke_data'], 0); + gl.uniform1i(locations['u_stroke_texture_size'], config.dynamic_stroke_texture_size); + gl.enableVertexAttribArray(locations['a_a']); gl.enableVertexAttribArray(locations['a_b']); gl.enableVertexAttribArray(locations['a_stroke_id']);