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: boolLineSegments.isLineSegments. The single bit that separates the two
subclasses for everything this port does with them.
Implementations§
Source§impl Line
impl Line
Sourcepub fn new(
geometry: Rc<BufferGeometry>,
material: MeshBasicNodeMaterial,
) -> ObjectRef
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.
Sourcepub fn raycast(
&self,
matrix_world: &Matrix4,
scale: &Vector3,
object: &ObjectRef,
raycaster: &Raycaster,
intersects: &mut Vec<Intersection>,
)
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.
Sourcepub fn set_positions(&self, positions: &[f32])
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.