|
|
@ -278,7 +278,7 @@ async function draw(state, context, animate, ts) { |
|
|
|
let total_lod_floats = 0; |
|
|
|
let total_lod_floats = 0; |
|
|
|
let total_lod_indices = 0; |
|
|
|
let total_lod_indices = 0; |
|
|
|
let stat_total_vertices = 0; |
|
|
|
let stat_total_vertices = 0; |
|
|
|
for (let i = 0; i <= 7; ++i) { |
|
|
|
for (let i = 0; i <= 6; ++i) { |
|
|
|
const d = geometry_good_circle_and_dummy(i); |
|
|
|
const d = geometry_good_circle_and_dummy(i); |
|
|
|
lod_levels.push({ |
|
|
|
lod_levels.push({ |
|
|
|
'data': d, |
|
|
|
'data': d, |
|
|
@ -353,12 +353,23 @@ async function draw(state, context, animate, ts) { |
|
|
|
for (let b = 0; b < context.instance_data_batches.size - 2; b += 2) { |
|
|
|
for (let b = 0; b < context.instance_data_batches.size - 2; b += 2) { |
|
|
|
const batch_from = context.instance_data_batches.data[b + 0]; |
|
|
|
const batch_from = context.instance_data_batches.data[b + 0]; |
|
|
|
const batch_size = context.instance_data_batches.data[b + 2] - batch_from; |
|
|
|
const batch_size = context.instance_data_batches.data[b + 2] - batch_from; |
|
|
|
const level = lod_levels[context.instance_data_batches.data[b + 1]]; |
|
|
|
let lod_level = context.instance_data_batches.data[b + 1]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (config.debug_force_lod !== null) { |
|
|
|
|
|
|
|
lod_level = config.debug_force_lod; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const level = lod_levels[lod_level]; |
|
|
|
|
|
|
|
|
|
|
|
if (batch_size > 0) { |
|
|
|
if (batch_size > 0) { |
|
|
|
stat_total_vertices += batch_size * level.data.indices.size; |
|
|
|
stat_total_vertices += batch_size * level.data.indices.size; |
|
|
|
|
|
|
|
|
|
|
|
gl.uniform1i(pr.locations['u_circle_points'], level.data.points.size / 2 - 4); |
|
|
|
gl.uniform1i(pr.locations['u_circle_points'], level.data.points.size / 2 - 4); |
|
|
|
|
|
|
|
gl.uniform3f(pr.locations['u_debug_color'], |
|
|
|
|
|
|
|
(lod_level * 785892 + 125127) % 8 / 7, |
|
|
|
|
|
|
|
(lod_level * 901824 + 985835) % 8 / 7, |
|
|
|
|
|
|
|
(lod_level * 232181 + 838533) % 8 / 7, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// Points (a, b) and stroke ids are stored in separate cpu buffers so that points can be reused (look at stride and offset values)
|
|
|
|
// Points (a, b) and stroke ids are stored in separate cpu buffers so that points can be reused (look at stride and offset values)
|
|
|
|
gl.vertexAttribPointer(pr.locations['a_a'], 2, gl.FLOAT, false, 2 * 4, batch_from * 2 * 4); |
|
|
|
gl.vertexAttribPointer(pr.locations['a_a'], 2, gl.FLOAT, false, 2 * 4, batch_from * 2 * 4); |
|
|
|