use super::*;
mod helpers;
use helpers::*;
mod gpu;
mod point;
mod rect;
impl ViewportRenderer {
pub(crate) fn cache_pick_items(&mut self, frame: &FrameData) {
let surfaces = match &frame.scene.surfaces {
SurfaceSubmission::Flat(items) => items.as_ref(),
};
self.pick_scene_items = surfaces
.iter()
.cloned()
.chain(
frame
.scene
.volume_meshes
.iter()
.filter(|item| item.transparency.is_none())
.map(|item| item.to_render_item()),
)
.collect();
self.pick_point_cloud_items = frame.scene.point_clouds.clone();
self.pick_splat_items = frame.scene.gaussian_splats.clone();
self.pick_volume_items = frame.scene.volumes.clone();
self.pick_scatter_volume_items = frame.scene.scatter_volumes.clone();
self.pick_volume_mesh_items = frame.scene.volume_meshes.clone();
self.pick_polyline_items = frame.scene.polylines.clone();
self.pick_glyph_items = frame.scene.glyphs.clone();
self.pick_tensor_glyph_items = frame.scene.tensor_glyphs.clone();
self.pick_sprite_items = frame.scene.sprite_items.clone();
self.pick_streamtube_items = frame.scene.streamtube_items.clone();
self.pick_tube_items = frame.scene.tube_items.clone();
self.pick_ribbon_items = frame.scene.ribbon_items.clone();
self.pick_image_slice_items = frame.scene.image_slices.clone();
self.pick_volume_surface_slice_items = frame.scene.volume_surface_slices.clone();
self.pick_screen_image_items = frame.scene.screen_images.clone();
}
pub(crate) fn clear_pick_cache(&mut self) {
self.pick_scene_items = Vec::new();
self.pick_point_cloud_items = Vec::new();
self.pick_splat_items = Vec::new();
self.pick_volume_items = Vec::new();
self.pick_scatter_volume_items = Vec::new();
self.pick_volume_mesh_items = Vec::new();
self.pick_polyline_items = Vec::new();
self.pick_glyph_items = Vec::new();
self.pick_tensor_glyph_items = Vec::new();
self.pick_sprite_items = Vec::new();
self.pick_streamtube_items = Vec::new();
self.pick_tube_items = Vec::new();
self.pick_ribbon_items = Vec::new();
self.pick_image_slice_items = Vec::new();
self.pick_volume_surface_slice_items = Vec::new();
self.pick_screen_image_items = Vec::new();
}
}
#[derive(Clone, Debug, Default)]
pub struct PickRectResult {
pub objects: Vec<u64>,
pub elements: Vec<(u64, crate::interaction::sub_object::SubObjectRef)>,
}
impl PickRectResult {
pub fn is_empty(&self) -> bool {
self.objects.is_empty() && self.elements.is_empty()
}
}