|
|
|
@ -3,23 +3,24 @@ function push_point_xy(s, x, y) {
@@ -3,23 +3,24 @@ function push_point_xy(s, x, y) {
|
|
|
|
|
ser_f32(s, y); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function push_point_xyrgb(s, x, y, r, g, b) { |
|
|
|
|
function push_point_xyzrgb(s, x, y, z, r, g, b) { |
|
|
|
|
ser_f32(s, x); |
|
|
|
|
ser_f32(s, y); |
|
|
|
|
ser_f32(s, z); |
|
|
|
|
ser_u8(s, r); |
|
|
|
|
ser_u8(s, g); |
|
|
|
|
ser_u8(s, b); |
|
|
|
|
ser_align(s, 4); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function push_quad_xyrgb(s, p1x, p1y, p4x, p4y, r, g, b) { |
|
|
|
|
push_point_xyrgb(s, p1x, p1y, r, g, b); |
|
|
|
|
push_point_xyrgb(s, p4x, p1y, r, g, b); |
|
|
|
|
push_point_xyrgb(s, p1x, p4y, r, g, b); |
|
|
|
|
function push_quad_xyzrgb(s, p1x, p1y, p4x, p4y, z, r, g, b) { |
|
|
|
|
push_point_xyzrgb(s, p1x, p1y, z, r, g, b); |
|
|
|
|
push_point_xyzrgb(s, p4x, p1y, z, r, g, b); |
|
|
|
|
push_point_xyzrgb(s, p1x, p4y, z, r, g, b); |
|
|
|
|
|
|
|
|
|
push_point_xyrgb(s, p4x, p4y, r, g, b); |
|
|
|
|
push_point_xyrgb(s, p1x, p4y, r, g, b); |
|
|
|
|
push_point_xyrgb(s, p4x, p1y, r, g, b); |
|
|
|
|
push_point_xyzrgb(s, p4x, p4y, z, r, g, b); |
|
|
|
|
push_point_xyzrgb(s, p1x, p4y, z, r, g, b); |
|
|
|
|
push_point_xyzrgb(s, p4x, p1y, z, r, g, b); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function push_stroke(context, stroke) { |
|
|
|
@ -43,21 +44,21 @@ function push_stroke(context, stroke) {
@@ -43,21 +44,21 @@ function push_stroke(context, stroke) {
|
|
|
|
|
|
|
|
|
|
let min_x, min_y, max_x, max_y; |
|
|
|
|
|
|
|
|
|
min_x = Math.floor(points[0].x); |
|
|
|
|
max_x = Math.ceil(points[0].x); |
|
|
|
|
min_x = Math.floor(points[0].x - stroke_width / 2); |
|
|
|
|
max_x = Math.ceil(points[0].x + stroke_width / 2); |
|
|
|
|
|
|
|
|
|
min_y = Math.floor(points[0].y); |
|
|
|
|
max_y = Math.ceil(points[0].y); |
|
|
|
|
min_y = Math.floor(points[0].y - stroke_width / 2); |
|
|
|
|
max_y = Math.ceil(points[0].y + stroke_width / 2); |
|
|
|
|
|
|
|
|
|
for (const p of points) { |
|
|
|
|
min_x = Math.min(min_x, Math.floor(p.x)); |
|
|
|
|
min_y = Math.min(min_y, Math.floor(p.y)); |
|
|
|
|
max_x = Math.max(max_x, Math.ceil(p.x)); |
|
|
|
|
max_y = Math.max(max_y, Math.ceil(p.y)); |
|
|
|
|
min_x = Math.min(min_x, Math.floor(p.x - stroke_width / 2)); |
|
|
|
|
min_y = Math.min(min_y, Math.floor(p.y - stroke_width / 2)); |
|
|
|
|
max_x = Math.max(max_x, Math.ceil(p.x + stroke_width / 2)); |
|
|
|
|
max_y = Math.max(max_y, Math.ceil(p.y + stroke_width / 2)); |
|
|
|
|
push_point_xy(context.point_serializer, p.x, p.y); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
push_quad_xyrgb(context.quad_serializer, min_x, min_y, max_x, max_y, r, g, b); |
|
|
|
|
push_quad_xyzrgb(context.quad_serializer, min_x, min_y, max_x, max_y, stroke_width / 2, r, g, b); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function geometry_prepare_stroke(state) { |
|
|
|
|