(
commands: &mut Commands,
meshes: &mut ResMut<Assets<Mesh>>,
plot: &mut Plot,
plot_handle: &Handle<Plot>,
)
| 67 | } |
| 68 | |
| 69 | fn plot_points( |
| 70 | commands: &mut Commands, |
| 71 | meshes: &mut ResMut<Assets<Mesh>>, |
| 72 | plot: &mut Plot, |
| 73 | plot_handle: &Handle<Plot>, |
| 74 | ) { |
| 75 | let data = plot.data.clone(); |
| 76 | // let color = data.marker_plot.color; |
| 77 | for marker_plot in data.marker_groups.iter() { |
| 78 | let ys = marker_plot.data.clone(); |
| 79 | // let color = marker_plot.color; |
| 80 | // let ys_world = plot.plot_to_local(&ys); |
| 81 | let ys_world = ys.iter().map(|y| plot.to_local(*y)).collect::<Vec<Vec2>>(); |
| 82 | |
| 83 | let quad_size = 30.0; |
| 84 | |
| 85 | commands |
| 86 | .spawn_bundle(( |
| 87 | Mesh2dHandle(meshes.add(Mesh::from(shape::Quad { |
| 88 | size: Vec2::splat(quad_size), |
| 89 | flip: false, |
| 90 | }))), |
| 91 | GlobalTransform::default(), |
| 92 | Transform::from_translation(Vec3::new(0.0, 0.0, 1.12)), |
| 93 | Visibility::default(), |
| 94 | ComputedVisibility::default(), |
| 95 | MarkerInstanceMatData( |
| 96 | ys_world |
| 97 | .iter() |
| 98 | .map(|v| MarkerInstanceData { |
| 99 | // |
| 100 | // TODO: take inner border into account |
| 101 | // |
| 102 | position: Vec3::new(v.x, v.y, 1.01) + plot.canvas_position.extend(0.000), |
| 103 | scale: 1.0, |
| 104 | color: Color::rgba(0.8, 0.6, 0.1, 1.0).as_rgba_f32(), |
| 105 | }) |
| 106 | .collect(), |
| 107 | ), |
| 108 | NoFrustumCulling, |
| 109 | // NoFrustumCulling, |
| 110 | )) |
| 111 | .insert(plot_handle.clone()) |
| 112 | .insert(MarkerUniform { |
| 113 | marker_size: marker_plot.size, |
| 114 | hole_size: 1.0, |
| 115 | zoom: 1.0, |
| 116 | marker_type: marker_plot.marker_style.to_int32(), |
| 117 | marker_point_color: col_to_vec4(marker_plot.marker_point_color), |
| 118 | color: col_to_vec4(marker_plot.color), |
| 119 | quad_size, |
| 120 | inner_canvas_size_in_pixels: plot.canvas_size / (1.0 + plot.outer_border), |
| 121 | // outer_border: plot.outer_border, |
| 122 | canvas_position: plot.canvas_position, |
| 123 | contour: if marker_plot.draw_contour { 1.0 } else { 0.0 }, |
| 124 | }); |
| 125 | } |
| 126 | } |
no test coverage detected