Skip to main content

Line

Struct Line 

Source
pub struct Line {
    pub geometry: Rc<BufferGeometry>,
    pub material: Option<MeshBasicNodeMaterial>,
    pub is_line_segments: bool,
}
Expand description

The state Line adds to Object3D: geometry and material, exactly as Mesh has them. It lives in a node’s Payload — see docs/scene-graph.md.

Fields§

§geometry: Rc<BufferGeometry>

Line.geometry.

§material: Option<MeshBasicNodeMaterial>

Line.material.

§is_line_segments: bool

LineSegments.isLineSegments. The single bit that separates the two subclasses for everything this port does with them.

Implementations§

Source§

impl Line

Source

pub fn new( geometry: Rc<BufferGeometry>, material: MeshBasicNodeMaterial, ) -> ObjectRef

new Line( geometry, material ).

three.js defaults the material to new LineBasicMaterial(), which under WebGPURenderer is a LineBasicNodeMaterial; the port takes it by value because every call site on the ladder passes one.

Source

pub fn raycast( &self, matrix_world: &Matrix4, scale: &Vector3, object: &ObjectRef, raycaster: &Raycaster, intersects: &mut Vec<Intersection>, )

Line.raycast( raycaster, intersects ) — every segment that passes within raycaster.params.line.threshold of the ray. scale is the node’s local scale, which three.js divides the threshold by.

LineSegments walks the vertices two at a time, Line one at a time.

Source

pub fn set_positions(&self, positions: &[f32])

Rewrite the line’s position attribute and mark it for re-upload — positions is the flat [ x, y, z, x, y, z, ... ] of values, item_size per vertex.

The convenience form of setXYZ() per vertex then set_needs_update, which is what a consumer moving one wall of a diagram wants instead of rebuilding the scene (issue #47). The next render re-writes that one buffer; the geometry keeps its id and its other buffers.

Any array kind takes the values as setXYZ() would (normalized and narrowed); an own Float32Array is copied straight in. An attribute with its own array takes a new length (its array is rebuilt in the same kind); an interleaved one keeps its count.

§Panics

If the geometry has no position attribute, or it is interleaved and positions is longer than its items.

Trait Implementations§

Source§

impl Clone for Line

Source§

fn clone(&self) -> Self

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Line

§

impl !Send for Line

§

impl !Sync for Line

§

impl !UnwindSafe for Line

§

impl Freeze for Line

§

impl Unpin for Line

§

impl UnsafeUnpin for Line

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.