use re_log_types::EntityPathHash;
use super::UiLabel;
use crate::{view_kind::SpatialSpaceViewKind, visualizers::LoadingSpinner, PickableTexturedRect};
pub struct SpatialViewVisualizerData {
pub loading_spinners: Vec<LoadingSpinner>,
pub ui_labels: Vec<UiLabel>,
pub bounding_boxes: Vec<(EntityPathHash, re_math::BoundingBox)>,
pub pickable_rects: Vec<PickableTexturedRect>,
pub preferred_view_kind: Option<SpatialSpaceViewKind>,
}
impl SpatialViewVisualizerData {
pub fn new(preferred_view_kind: Option<SpatialSpaceViewKind>) -> Self {
Self {
loading_spinners: Default::default(),
ui_labels: Default::default(),
bounding_boxes: Default::default(),
pickable_rects: Default::default(),
preferred_view_kind,
}
}
pub fn add_bounding_box(
&mut self,
entity: EntityPathHash,
bbox: re_math::BoundingBox,
world_from_obj: glam::Affine3A,
) {
self.bounding_boxes
.push((entity, bbox.transform_affine3(&world_from_obj)));
}
pub fn add_bounding_box_from_points(
&mut self,
entity: EntityPathHash,
points: impl Iterator<Item = glam::Vec3>,
world_from_obj: glam::Affine3A,
) {
re_tracing::profile_function!();
self.add_bounding_box(
entity,
re_math::BoundingBox::from_points(points),
world_from_obj,
);
}
pub fn as_any(&self) -> &dyn std::any::Any {
self
}
}