Browse Source

Fix bvh fullnodes returning full buffer instead of tv_data. Skip handling of empty strokes

ssao
A.Olokhtonov 7 months ago
parent
commit
221e2a5aed
  1. 2
      client/bvh.js
  2. 5
      client/client_recv.js
  3. 34
      client/index.html
  4. 1
      client/speed.js
  5. 5
      client/webgl_draw.js

2
client/bvh.js

@ -175,7 +175,7 @@ function bvh_intersect_quad(bvh, quad, result_buffer) { @@ -175,7 +175,7 @@ function bvh_intersect_quad(bvh, quad, result_buffer) {
if (node.is_fullnode) {
if (quad_fully_inside(quad, node.bbox)) {
tv_append(result_buffer, node.stroke_indices.data);
tv_append(result_buffer, tv_data(node.stroke_indices));
continue;
}
}

5
client/client_recv.js

@ -112,7 +112,6 @@ function des_event(d, state = null) { @@ -112,7 +112,6 @@ function des_event(d, state = null) {
// TODO: remove, this is duplicate data
event.stroke_id = stroke_id;
event.color = color;
@ -242,6 +241,10 @@ function handle_event(state, context, event, options = {}) { @@ -242,6 +241,10 @@ function handle_event(state, context, event, options = {}) {
case EVENT.STROKE: {
const point_count = event.coords.length / 2;
if (point_count === 0) {
break;
}
wasm_ensure_by(state, 1, event.coords.length);
const pressures = state.wasm.buffers['pressures'];

34
client/index.html

@ -7,23 +7,23 @@ @@ -7,23 +7,23 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="shortcut icon" href="icons/favicon.svg" id="favicon">
<link rel="stylesheet" type="text/css" href="default.css?v=73">
<script type="text/javascript" src="aux.js?v=73"></script>
<script type="text/javascript" src="heapify.js?v=73"></script>
<script type="text/javascript" src="bvh.js?v=73"></script>
<script type="text/javascript" src="math.js?v=73"></script>
<script type="text/javascript" src="tools.js?v=73"></script>
<script type="text/javascript" src="speed.js?v=73"></script>
<script type="text/javascript" src="webgl_geometry.js?v=73"></script>
<script type="text/javascript" src="webgl_shaders.js?v=73"></script>
<script type="text/javascript" src="webgl_listeners.js?v=73"></script>
<script type="text/javascript" src="webgl_draw.js?v=73"></script>
<script type="text/javascript" src="index.js?v=73"></script>
<script type="text/javascript" src="client_send.js?v=73"></script>
<script type="text/javascript" src="client_recv.js?v=73"></script>
<script type="text/javascript" src="websocket.js?v=73"></script>
<link rel="stylesheet" type="text/css" href="default.css">
<script type="text/javascript" src="aux.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>
<script type="text/javascript" src="tools.js"></script>
<script type="text/javascript" src="speed.js"></script>
<script type="text/javascript" src="webgl_geometry.js"></script>
<script type="text/javascript" src="webgl_shaders.js"></script>
<script type="text/javascript" src="webgl_listeners.js"></script>
<script type="text/javascript" src="webgl_draw.js"></script>
<script type="text/javascript" src="index.js"></script>
<script type="text/javascript" src="client_send.js"></script>
<script type="text/javascript" src="client_recv.js"></script>
<script type="text/javascript" src="websocket.js"></script>
</head>
<body>
<div class="main">

1
client/speed.js

@ -200,6 +200,7 @@ async function do_lod(state, context) { @@ -200,6 +200,7 @@ async function do_lod(state, context) {
}
await workers_messages(state.wasm.workers, jobs);
const result_offset = state.wasm.exports.merge_results(
result_counts,
result_buffers,

5
client/webgl_draw.js

@ -78,7 +78,7 @@ function draw_html(state) { @@ -78,7 +78,7 @@ function draw_html(state) {
async function draw(state, context) {
const cpu_before = performance.now();
try {
const gl = context.gl;
const width = window.innerWidth;
const height = window.innerHeight;
@ -228,6 +228,9 @@ async function draw(state, context) { @@ -228,6 +228,9 @@ async function draw(state, context) {
setTimeout(next_tick, 0);
}
} catch (e) {
console.error('Draw failed:', e);
}
const cpu_after = performance.now();

Loading…
Cancel
Save