Skip to main content

SceneSpec

Struct SceneSpec 

Source
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: Framing

How 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: CameraControls

Pointer 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

Source

pub fn new() -> Self

Source

pub fn points(self, handle: PointsHandle) -> Self

Add a point/scatter mark with the default style.

Source

pub fn points_styled(self, handle: PointsHandle, style: PointStyle) -> Self

Add a point mark with an explicit style.

Source

pub fn points_labeled( self, handle: PointsHandle, style: PointStyle, labels: PointLabels, ) -> Self

Add a point mark with per-point labels / hover tooltips.

Source

pub fn add_points(self, draw: PointDraw) -> Self

Add a fully-specified point mark (transform + style).

Source

pub fn mesh(self, handle: MeshHandle) -> Self

Add a mesh mark with the default material.

Source

pub fn mesh_with(self, handle: MeshHandle, material: Material) -> Self

Add a mesh mark with an explicit material.

Source

pub fn add_mesh(self, draw: MeshDraw) -> Self

Add a fully-specified mesh mark (transform + material).

Source

pub fn lines(self, handle: LinesHandle) -> Self

Add a line mark with the default style.

Source

pub fn lines_styled(self, handle: LinesHandle, style: LineStyle) -> Self

Add a line mark with an explicit style.

Source

pub fn add_lines(self, draw: LineDraw) -> Self

Add a fully-specified line mark (transform + style).

Source

pub fn grid(self, planes: GridPlanes) -> Self

Set which planes carry the reference grid.

Source

pub fn no_grid(self) -> Self

Turn the reference grid off.

Source

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.

Source

pub fn background(self, color: Color) -> Self

Fill the scene background (default leaves it transparent).

Source

pub fn style(self, style: SceneStyle) -> Self

Replace the whole style block.

Source

pub fn lights(self, rig: LightRig) -> Self

Replace the light rig.

Source

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.

Source

pub fn framing(self, framing: Framing) -> Self

Set how the camera relates to the data bounds (default Framing::Auto).

Source

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.

Source

pub fn controls(self, controls: CameraControls) -> Self

Choose the pointer navigation scheme (default CameraControls::Orbit).

Source

pub fn axes(self, axes: Axes) -> Self

Enable axis labels with the given configuration.

Source

pub fn axis_titles( self, x: impl Into<String>, y: impl Into<String>, z: impl Into<String>, ) -> Self

Enable axis labels with default styling and the three titles set.

Trait Implementations§

Source§

impl Clone for SceneSpec

Source§

fn clone(&self) -> SceneSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SceneSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SceneSpec

Source§

fn default() -> SceneSpec

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.