pub struct Viewport { /* private fields */ }Expand description
The central 3D viewport: the engine’s render core + the app-owned offscreen
texture + the egui blit that composites it into egui’s frame, plus the
pointer/wheel/ViewCube routing. Borrows &mut EngineState to draw + drive;
never owns the engine brain.
Implementations§
Source§impl Viewport
impl Viewport
Sourcepub fn new(render_state: &RenderState) -> Self
pub fn new(render_state: &RenderState) -> Self
Build the viewport’s GPU resources from eframe’s SHARED render state. We
render in the engine’s native COLOR_FORMAT (Rgba8Unorm) — exactly what
the headless artifact path uses, so colors are known-good — and the blit
converts into eframe’s actual target format.
Source§impl Viewport
impl Viewport
Sourcepub fn last_rect(&self) -> Option<Rect>
pub fn last_rect(&self) -> Option<Rect>
The rect (egui points) the viewport last drew into. Now that the viewport
is a dock PANE (its rect moves as the user re-frames it), the shell anchors
the floating context / Finish-Cancel overlays to THIS rect’s right edge so
they stay glued to the 3D view — see the top-right overlay in app.rs.
None before the first draw (shell falls back to window-right until then).
Sourcepub fn viewport_rect_json(&self) -> String
pub fn viewport_rect_json(&self) -> String
The last viewport rect as {x, y, w, h} in egui points (verification: the
origin lets the verifier map engine viewport-local pick coords → page px).
Sourcepub fn show(&mut self, ui: &mut Ui, state: &mut EngineState)
pub fn show(&mut self, ui: &mut Ui, state: &mut EngineState)
The clean entry the shell calls: fill the central panel with the 3D viewport — size tracking, input routing, on-demand render, and the blit composite. Borrows the engine brain to draw + drive.
Source§impl Viewport
impl Viewport
Sourcepub fn forget_document(&mut self)
pub fn forget_document(&mut self)
Drop everything this viewport is holding ABOUT ONE DOCUMENT — called when
the shell switches the active document (see crate::document).
The GPU cache is the load-bearing half: GpuScene keys its retained
buffers by SOLID NAME and reuses one while the solid’s revision is
unchanged, but revisions are per-EngineState and every document counts
from the same place — so document B’s “Box” rev 1 would be served
document A’s uploaded mesh. Only the active document renders, so a full
re-upload on the switch is the right price. The transients after it
(pick popup, open dimension editors, in-flight drags) all name entities
of the document that is going away.
Sourcepub fn close_candidate_popup(&mut self) -> bool
pub fn close_candidate_popup(&mut self) -> bool
Close the pick-list popup if open; returns whether one WAS open. The app shell’s global Escape routes here FIRST so dismissing the list never clears a selection built through it.
Auto Trait Implementations§
impl !RefUnwindSafe for Viewport
impl !UnwindSafe for Viewport
impl Freeze for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnsafeUnpin for Viewport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more