pub struct SceneSpec {
pub meshes: Vec<MeshDraw>,
pub points: Vec<PointDraw>,
pub lines: Vec<LineDraw>,
pub lights: LightRig,
pub style: SceneStyle,
pub camera: Option<CameraState>,
pub framing: Framing,
pub focus: Option<Focus>,
pub controls: CameraControls,
pub axes: Option<Axes>,
}Expand description
Declarative scene description: the marks plus styling. Resolved into a
Scene3DData at draw time (the camera is
auto-framed against the marks’ combined bounds, or taken from
SceneSpec::camera when set).
Fields§
§meshes: Vec<MeshDraw>§points: Vec<PointDraw>§lines: Vec<LineDraw>§lights: LightRig§style: SceneStyle§camera: Option<CameraState>App-supplied camera pose. With Framing::Manual it is used
verbatim; with Auto/Fit its orbit angles seed the framed view.
None uses a default three-quarter pose.
framing: FramingHow the camera relates to the data bounds. Defaults to
Framing::Auto (fit, then free).
focus: Option<Focus>Declarative focus request. Changing it animates the camera to the
new viewpoint (under Auto/Fit). None leaves framing/gestures
in charge.
controls: CameraControlsPointer navigation scheme (default CameraControls::Orbit).
axes: Option<Axes>Axis tick/title labels. None (the default) draws no labels;
Some projects labels through the camera at draw time. Independent
of SceneStyle::show_axes, which draws the axis lines.
Implementations§
Source§impl SceneSpec
impl SceneSpec
pub fn new() -> Self
Sourcepub fn points(self, handle: PointsHandle) -> Self
pub fn points(self, handle: PointsHandle) -> Self
Add a point/scatter mark with the default style.
Sourcepub fn points_styled(self, handle: PointsHandle, style: PointStyle) -> Self
pub fn points_styled(self, handle: PointsHandle, style: PointStyle) -> Self
Add a point mark with an explicit style.
Sourcepub fn points_labeled(
self,
handle: PointsHandle,
style: PointStyle,
labels: PointLabels,
) -> Self
pub fn points_labeled( self, handle: PointsHandle, style: PointStyle, labels: PointLabels, ) -> Self
Add a point mark with per-point labels / hover tooltips.
Sourcepub fn add_points(self, draw: PointDraw) -> Self
pub fn add_points(self, draw: PointDraw) -> Self
Add a fully-specified point mark (transform + style).
Sourcepub fn mesh(self, handle: MeshHandle) -> Self
pub fn mesh(self, handle: MeshHandle) -> Self
Add a mesh mark with the default material.
Sourcepub fn mesh_with(self, handle: MeshHandle, material: Material) -> Self
pub fn mesh_with(self, handle: MeshHandle, material: Material) -> Self
Add a mesh mark with an explicit material.
Sourcepub fn add_mesh(self, draw: MeshDraw) -> Self
pub fn add_mesh(self, draw: MeshDraw) -> Self
Add a fully-specified mesh mark (transform + material).
Sourcepub fn lines(self, handle: LinesHandle) -> Self
pub fn lines(self, handle: LinesHandle) -> Self
Add a line mark with the default style.
Sourcepub fn lines_styled(self, handle: LinesHandle, style: LineStyle) -> Self
pub fn lines_styled(self, handle: LinesHandle, style: LineStyle) -> Self
Add a line mark with an explicit style.
Sourcepub fn add_lines(self, draw: LineDraw) -> Self
pub fn add_lines(self, draw: LineDraw) -> Self
Add a fully-specified line mark (transform + style).
Sourcepub fn grid(self, planes: GridPlanes) -> Self
pub fn grid(self, planes: GridPlanes) -> Self
Set which planes carry the reference grid.
Sourcepub fn axis_bounds(self, axis: AxisKind, min: f32, max: f32) -> Self
pub fn axis_bounds(self, axis: AxisKind, min: f32, max: f32) -> Self
Clip one axis to an explicit world [min, max], overriding the
symmetric grid extent for that axis alone. The grid plane lines, the
axis line, and the axis’s ticks/title all honour the bound; the other
axes stay symmetric. Useful for a naturally one-sided axis — e.g. CIE
L* ∈ [0, 100], which should never draw a negative half.
Sourcepub fn background(self, color: Color) -> Self
pub fn background(self, color: Color) -> Self
Fill the scene background (default leaves it transparent).
Sourcepub fn style(self, style: SceneStyle) -> Self
pub fn style(self, style: SceneStyle) -> Self
Replace the whole style block.
Sourcepub fn camera(self, state: CameraState) -> Self
pub fn camera(self, state: CameraState) -> Self
Supply an explicit camera pose. With Framing::Manual it is the
authoritative pose; otherwise its orbit angles seed the framed view.
Sourcepub fn framing(self, framing: Framing) -> Self
pub fn framing(self, framing: Framing) -> Self
Set how the camera relates to the data bounds (default
Framing::Auto).
Sourcepub fn focus(self, focus: Focus) -> Self
pub fn focus(self, focus: Focus) -> Self
Request the camera animate to a Focus. Changing the value
across rebuilds triggers a smooth move; passing the same value is a
no-op.
Sourcepub fn controls(self, controls: CameraControls) -> Self
pub fn controls(self, controls: CameraControls) -> Self
Choose the pointer navigation scheme (default
CameraControls::Orbit).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SceneSpec
impl RefUnwindSafe for SceneSpec
impl Send for SceneSpec
impl Sync for SceneSpec
impl Unpin for SceneSpec
impl UnsafeUnpin for SceneSpec
impl UnwindSafe for SceneSpec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.