MCPcopy Create free account
hub / github.com/donkeyteethUX/iced_plot / write_polyline_triangles

Function write_polyline_triangles

src/plot_renderer/shader.rs:1755–1813  ·  view source on GitHub ↗
(
    writer: &mut VertexWriter,
    segs: &mut Vec<LineSegment>,
    polyline: PolylineRef<'_>,
    style: LineRenderStyle,
)

Source from the content-addressed store, hash-verified

1753 let mut pass = params.encoder.begin_render_pass(&RenderPassDescriptor {
1754 label: Some("selection overlay"),
1755 color_attachments: &[Some(msaa_attachment(msaa_targets, LoadOp::Load))],
1756 depth_stencil_attachment: None,
1757 occlusion_query_set: None,
1758 timestamp_writes: None,
1759 });
1760
1761 // Set viewport and scissor for selection overlay as well
1762 pass.set_viewport(x, y, width, height, 0.0, 1.0);
1763 pass.set_scissor_rect(
1764 params.clip_bounds.x,
1765 params.clip_bounds.y,
1766 params.clip_bounds.width,
1767 params.clip_bounds.height,
1768 );
1769
1770 pass.set_pipeline(pipeline);
1771 // Draw selection if present
1772 if let Some(vb) = &self.buffers.selection {
1773 pass.set_vertex_buffer(0, vb.buffer.slice(..));
1774 pass.draw(0..vb.vertex_count, 0..1);
1775 }
1776 // Draw highlight mask boxes if present
1777 // Each mask box is a quad (4 vertices) in TriangleStrip topology
1778 if let Some(vb) = &self.buffers.highlight {
1779 pass.set_vertex_buffer(0, vb.buffer.slice(..));
1780 // Draw each quad separately (4 vertices per quad)
1781 let quad_count = vb.vertex_count / 4;
1782 for i in 0..quad_count {
1783 pass.draw(i * 4..(i + 1) * 4, 0..1);
1784 }
1785 }
1786 }
1787
1788 // Crosshairs overlay (using line list topology)
1789 if let (Some(pipeline), Some(vb)) = (
1790 self.pipelines.line_overlay.as_ref(),
1791 &self.buffers.crosshairs,
1792 ) {
1793 let mut pass = params.encoder.begin_render_pass(&RenderPassDescriptor {
1794 label: Some("crosshairs overlay"),
1795 color_attachments: &[Some(msaa_attachment(msaa_targets, LoadOp::Load))],
1796 depth_stencil_attachment: None,
1797 occlusion_query_set: None,
1798 timestamp_writes: None,
1799 });
1800
1801 // Set viewport and scissor for crosshairs overlay
1802 pass.set_viewport(x, y, width, height, 0.0, 1.0);
1803 pass.set_scissor_rect(
1804 params.clip_bounds.x,
1805 params.clip_bounds.y,
1806 params.clip_bounds.width,
1807 params.clip_bounds.height,
1808 );
1809
1810 pass.set_pipeline(pipeline);
1811 pass.set_vertex_buffer(0, vb.buffer.slice(..));
1812 pass.draw(0..vb.vertex_count, 0..1);

Callers 2

rebuild_linesMethod · 0.85
rebuild_reflinesMethod · 0.85

Calls 3

line_width_paramsFunction · 0.85
byte_lenMethod · 0.80
write_line_vertexMethod · 0.80

Tested by

no test coverage detected