use brep_render::controls::{BUTTON_LEFT, BUTTON_MIDDLE, BUTTON_RIGHT};
use brep_render::engine_state::EngineState;
use brep_render::pick::PickCandidate;
use brep_render::style::MultiSelectMode;
use brep_render::render::{FrameParams, GpuScene, RenderCore, COLOR_FORMAT};
use eframe::egui;
use eframe::egui_wgpu;
use std::sync::Arc;
struct ViewportPaint {
pipeline: wgpu::RenderPipeline,
bind_group: wgpu::BindGroup,
}
struct ViewportCallback;
struct Offscreen {
view: wgpu::TextureView,
w: u32,
h: u32,
}
struct CandidatePopup {
anchor: egui::Pos2,
candidates: Vec<PickCandidate>,
}
pub struct Viewport {
core: RenderCore,
gpu_scene: GpuScene,
egui_renderer: Arc<egui::mutex::RwLock<egui_wgpu::Renderer>>,
blit_layout: wgpu::BindGroupLayout,
blit_sampler: wgpu::Sampler,
blit_pipeline: wgpu::RenderPipeline,
offscreen: Option<Offscreen>,
dragging: bool,
gizmo_dragging: bool,
component_gizmo_dragging: bool,
dim_dragging: Option<String>,
sketch_dragging: bool,
sketch_handdrawing: bool,
last_rect: Option<egui::Rect>,
candidate_popup: Option<CandidatePopup>,
candidate_popup_fresh: bool,
candidate_popup_rect: Option<egui::Rect>,
candidate_hits: Vec<egui::Rect>,
editing_dim: Option<(serde_json::Value, String)>,
dim_edit_fresh: bool,
editing_feature_dim: Option<(String, String, String)>,
feature_dim_edit_fresh: bool,
constraint_dragging: bool,
constraint_label_hovered: Option<String>,
}
impl Viewport {
pub fn close_candidate_popup(&mut self) -> bool {
let was_open = self.candidate_popup.is_some();
self.candidate_popup = None;
self.candidate_popup_rect = None;
was_open
}
}
mod blit;
mod interaction;
mod labels;