Browse Source

Fix first stroke preview not showing

ssao
A.Olokhtonov 6 months ago
parent
commit
c6f8bc4b5a
  1. 9
      client/speed.js
  2. 8
      client/webgl_draw.js

9
client/speed.js

@ -65,27 +65,28 @@ async function init_wasm(state) { @@ -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,

8
client/webgl_draw.js

@ -323,6 +323,14 @@ async function draw(state, context, animate, ts) { @@ -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']);

Loading…
Cancel
Save