diff --git a/client/webgl_draw.js b/client/webgl_draw.js index 118d579..3610f7d 100644 --- a/client/webgl_draw.js +++ b/client/webgl_draw.js @@ -273,23 +273,8 @@ async function draw(state, context, animate, ts) { } } - if (false) { - // TODO: @speed maybe we can get this while clipping "for free"? - let largest_width = 0; - - for (let i = 0; i < context.clipped_indices.size; ++i) { - const stroke_id = context.clipped_indices.data[i]; - const stroke = state.events[stroke_id]; - if (stroke.width > largest_width) { - largest_width = stroke.width; - } - } - - largest_width *= state.canvas.zoom; - } - - // Largest distance from N-th circle LOD to a real circle should be less than 1 unit (pixel) - const circle_lod = 4; // largest_width > 0 ? Math.ceil(Math.PI / Math.acos(1 - 1 / largest_width)) : 0; + // TODO: what do we do with this + const circle_lod = Math.ceil(Math.min(7, 1 + Math.sqrt(state.canvas.zoom))); const circle_data = geometry_good_circle_and_dummy(circle_lod); // "Static" data upload diff --git a/client/webgl_shaders.js b/client/webgl_shaders.js index 04579f0..27ff5dc 100644 --- a/client/webgl_shaders.js +++ b/client/webgl_shaders.js @@ -12,7 +12,6 @@ const sdf_vs_src = `#version 300 es uniform int u_stroke_count; uniform int u_stroke_texture_size; uniform highp usampler2D u_stroke_data; - uniform float u_fixed_pixel_width; uniform int u_circle_points; out vec3 v_color; @@ -34,10 +33,6 @@ const sdf_vs_src = `#version 300 es uvec4 stroke_data = texelFetch(u_stroke_data, ivec2(stroke_data_x, stroke_data_y), 0); float radius = float(stroke_data.w); - if (u_fixed_pixel_width > 0.0) { - radius = u_fixed_pixel_width / u_scale.x; - } - vec2 pos; if (vertex_index < u_circle_points) { @@ -88,7 +83,7 @@ const sdf_fs_src = `#version 300 es void main() { if (u_debug_mode == 0) { - float alpha = 0.5; + float alpha = 0.75; FragColor = vec4(v_color * alpha, alpha); } else { FragColor = vec4(0.2, 0.0, 0.0, 0.2); @@ -327,10 +322,8 @@ function init_webgl(state, context) { gl.enable(gl.BLEND); gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - /* gl.enable(gl.DEPTH_TEST); gl.depthFunc(gl.NOTEQUAL); - */ context.gpu_timer_ext = gl.getExtension('EXT_disjoint_timer_query_webgl2'); if (context.gpu_timer_ext === null) {