Browse Source

Increase WASM mem limit to 256MB. Rename aux.js to not get adblocked.

Do not render lines less than 1px wide, instead fade out (Freya-esque
in that sense).
master
Aleksey Olokhtonov 3 days ago
parent
commit
dc1553dc1e
  1. 20
      README.txt
  2. 2
      client/config.js
  3. 2
      client/index.html
  4. 0
      client/random_helpers.js
  5. 4
      client/speed.js
  6. 2
      client/webgl_draw.js
  7. 16
      client/webgl_shaders.js

20
README.txt

@ -10,8 +10,7 @@ Release: @@ -10,8 +10,7 @@ Release:
+ Multithreading for LOD
+ Textured quads (pictures, code already written in older version
+ Resize and move pictures (draw handles)
- Z-prepass fringe bug (also, when do we enable the prepass?)
- Frame-independent lerp where applicable
+ Frame-independent lerp where applicable
- Dedup images on server, so we don't download the same image too many times
- No lag while downloading images
+ Bugs
@ -83,10 +82,7 @@ Bonus: @@ -83,10 +82,7 @@ Bonus:
+ Migrate old non-pressure desks
+ Check out e.pressure on touch devices
- Send pressure in PREDRAW event
- Stroke smoothing
https://github.com/xournalpp/xournalpp/issues/2320
https://www.digital-epigraphy.com/tutorials/the-most-useful-new-features-of-photoshop-cc-using-brush-stroke-smoothing-for-digital-inking
https://stackoverflow.com/questions/20618804/how-to-smooth-a-curve-for-a-dataset
+ Stroke smoothing
- Curve modification
- Select curves (with a lasso?)
- Move whole curve
@ -104,3 +100,15 @@ Bonus: @@ -104,3 +100,15 @@ Bonus:
Bonus-bonus:
- Actually infinite canvas (replace floats with something, some kind of fixed point scheme? chunks? multilevel scheme?)
Shiplist:
- Fix mess
- Redo
- User-friendly config
+ min 1px wide lines with transparency fade
- offline-only version
- select and manupulate curves with selection tool
- deduplicate pictures
- Color picker should work for ruler
- Show previous color in color picker preview
- No lag while downloading images

2
client/config.js

@ -6,7 +6,7 @@ const config = { @@ -6,7 +6,7 @@ const config = {
ws_reconnect_timeout: 2000,
brush_preview_timeout: 1000,
second_finger_timeout: 500,
debug_print: false,
debug_print: true,
draw_bvh: false,
draw_fullnodes: false,
zoom_delta: 0.05,

2
client/index.html

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
<!-- <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="random_helpers.js"></script>
<script type="text/javascript" src="heapify.js"></script>
<script type="text/javascript" src="bvh.js"></script>
<script type="text/javascript" src="math.js"></script>

0
client/aux.js → client/random_helpers.js

4
client/speed.js

@ -36,8 +36,8 @@ function workers_thread_message(workers, message, thread_field=null) { @@ -36,8 +36,8 @@ function workers_thread_message(workers, message, thread_field=null) {
async function init_wasm(state) {
const memory = new WebAssembly.Memory({
initial: 2048, // F U
maximum: 2048, // 128MiB
initial: 4096, // F U
maximum: 4096, // 256MiB
shared: true,
});

2
client/webgl_draw.js

@ -584,7 +584,7 @@ async function draw(state, context, animate, ts) { @@ -584,7 +584,7 @@ async function draw(state, context, animate, ts) {
<span>Total vertices: ${stat_total_vertices}</span>
<span>Canvas offset: (${Math.round(state.canvas.offset.x * 100) / 100}, ${Math.round(state.canvas.offset.y * 100) / 100})</span>
<span>Canvas zoom level: ${state.canvas.zoom_level}</span>
<span>Canvas zoom: ${Math.round(state.canvas.zoom * 100) / 100}</span>`;
<span>Canvas zoom: ${Math.round(state.canvas.zoom * 10000) / 10000}</span>`;
if (context.gpu_timer_ext) {
gl.endQuery(context.gpu_timer_ext.TIME_ELAPSED_EXT);

16
client/webgl_shaders.js

@ -16,7 +16,7 @@ const sdf_vs_src = `#version 300 es @@ -16,7 +16,7 @@ const sdf_vs_src = `#version 300 es
out vec3 v_color;
flat out vec2 v_thickness;
out float v_scalefade;
void main() {
vec2 screen02;
@ -31,7 +31,12 @@ const sdf_vs_src = `#version 300 es @@ -31,7 +31,12 @@ const sdf_vs_src = `#version 300 es
int stroke_data_y = stroke_index / u_stroke_texture_size;
int stroke_data_x = stroke_index % u_stroke_texture_size;
uvec4 stroke_data = texelFetch(u_stroke_data, ivec2(stroke_data_x, stroke_data_y), 0);
float radius = float(stroke_data.w);
float canvas_pixel = 1.0 / u_scale.x; // assuming square pixels here..
float radius = max(0.5 * canvas_pixel, float(stroke_data.w));
// Fade from 1.0 to 0.0 based on sqrt distance beyond being 1 pixel wide? (compeltely ad-hoc, picked whatever looked good to me)
float scalefade = float(stroke_data.w) / canvas_pixel;
v_scalefade = min(1.0, sqrt(scalefade));
vec2 pos;
@ -80,12 +85,13 @@ const sdf_fs_src = `#version 300 es @@ -80,12 +85,13 @@ const sdf_fs_src = `#version 300 es
uniform float u_opacity_multipliter;
in vec3 v_color;
in float v_scalefade;
layout(location = 0) out vec4 FragColor;
void main() {
if (u_debug_mode == 0) {
float alpha = 0.75 * u_opacity_multipliter;
float alpha = u_opacity_multipliter * v_scalefade;
FragColor = vec4(v_color * alpha, alpha);
} else {
FragColor = vec4(u_debug_color, 0.8);
@ -382,12 +388,12 @@ function init_webgl(state, context) { @@ -382,12 +388,12 @@ function init_webgl(state, context) {
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.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.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));
gl.bindTexture(gl.TEXTURE_2D, context.textures['ui']);
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.ui_texture_size, config.ui_texture_size, 0, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, new Uint16Array(config.ui_texture_size * config.ui_texture_size * 4)); // fill the whole texture once with zeroes to kill a warning about a partial upload
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA16UI, config.ui_texture_size, config.ui_texture_size, 0, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, new Uint16Array(config.ui_texture_size * config.ui_texture_size * 4));
const resize_canvas = (entries) => {
// https://www.khronos.org/webgl/wiki/HandlingHighDPI

Loading…
Cancel
Save