Browse Source

Fix dummy offsets not getting inserted if first event is not a stroke

ssao
A.Olokhtonov 6 months ago
parent
commit
4a6d1d6640
  1. 2
      client/client_recv.js
  2. 2
      client/index.html
  3. 4
      client/webgl_shaders.js

2
client/client_recv.js

@ -286,7 +286,7 @@ function handle_event(state, context, event, options = {}) { @@ -286,7 +286,7 @@ function handle_event(state, context, event, options = {}) {
}
}
const index_difference = state.events.length - (last_stroke === null ? 0 : last_stroke.index);
const index_difference = state.events.length - (last_stroke === null ? -1 : last_stroke.index);
wasm_ensure_by(state, index_difference, event.coords.length);
const pressures = state.wasm.buffers['pressures'];

2
client/index.html

@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
<link rel="shortcut icon" href="icons/favicon.svg" id="favicon">
<link rel="stylesheet" type="text/css" href="default.css">
<link rel="preload" href="icons/picker.svg" as="image" type="image/svg+xml" />
<!-- <link rel="preload" href="icons/picker.svg" as="image" type="image/svg+xml" /> -->
<script type="text/javascript" src="aux.js"></script>
<script type="text/javascript" src="heapify.js"></script>

4
client/webgl_shaders.js

@ -491,12 +491,12 @@ function init_webgl(state, context) { @@ -491,12 +491,12 @@ function init_webgl(state, context) {
gl.bindTexture(gl.TEXTURE_2D, context.textures['stroke_data']);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA16UI, config.stroke_texture_size, config.stroke_texture_size, 0, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, null);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA16UI, config.stroke_texture_size, config.stroke_texture_size, 0, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, new Uint16Array(config.stroke_texture_size * config.stroke_texture_size * 4)); // fill the whole texture once with zeroes to kill a warning about a partial upload
gl.bindTexture(gl.TEXTURE_2D, context.textures['dynamic_stroke_data']);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA16UI, config.dynamic_stroke_texture_size, config.dynamic_stroke_texture_size, 0, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, null);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA16UI, config.dynamic_stroke_texture_size, config.dynamic_stroke_texture_size, 0, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, new Uint16Array(config.dynamic_stroke_texture_size * config.dynamic_stroke_texture_size * 4)); // fill the whole texture once with zeroes to kill a warning about a partial upload
const resize_canvas = (entries) => {
// https://www.khronos.org/webgl/wiki/HandlingHighDPI

Loading…
Cancel
Save