diff --git a/client/index.html b/client/index.html index f1c1760..2e8cb41 100644 --- a/client/index.html +++ b/client/index.html @@ -56,7 +56,7 @@
- +
diff --git a/client/index.js b/client/index.js index 5fb5ae2..8a82057 100644 --- a/client/index.js +++ b/client/index.js @@ -19,8 +19,8 @@ const config = { second_finger_timeout: 500, buffer_first_touchmoves: 5, debug_print: false, - min_zoom: 0.0000005, - max_zoom: 10.0, + min_zoom: 1.0, + max_zoom: 1000, initial_offline_timeout: 1000, default_color: 0x00, default_width: 8, diff --git a/client/math.js b/client/math.js index 5d108e5..881ea28 100644 --- a/client/math.js +++ b/client/math.js @@ -7,7 +7,7 @@ function screen_to_canvas(state, p) { } function rdp_find_max(state, points, start, end) { - const EPS = 0.5 / Math.pow(state.canvas.zoom, 0.25); + const EPS = 1.0 / state.canvas.zoom; // const EPS = 10.0; let result = -1; @@ -86,6 +86,7 @@ function process_ewmv(points, round = false) { function process_stroke(state, points) { // const result0 = process_ewmv(points); const result1 = process_rdp(state, points, true); + console.debug('simplified to', points.length, 'points to', result1.length); return result1; } diff --git a/client/webgl_draw.js b/client/webgl_draw.js index d3b81ec..60bee84 100644 --- a/client/webgl_draw.js +++ b/client/webgl_draw.js @@ -164,6 +164,18 @@ function draw(state, context) { const dynamic_points = context.dynamic_serializer.offset / config.bytes_per_point; if (dynamic_points > 0) { + gl.drawBuffers([gl.BACK]); + + locations = context.locations['sdf'].main; + + gl.useProgram(context.programs['sdf'].main); + + 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'], state.stroke_count); + gl.uniform1i(locations['u_debug_mode'], state.debug.red); + gl.clear(gl.DEPTH_BUFFER_BIT); gl.bindBuffer(gl.ARRAY_BUFFER, buffers['b_packed_dynamic']);