pub struct Line { /* private fields */ }
Expand description
A rectangle 2D geometry which can be rendered using a camera created by Camera::new_2d.
Implementations§
source§impl Line
impl Line
sourcepub fn new(
context: &Context,
pixel0: impl Into<PhysicalPoint>,
pixel1: impl Into<PhysicalPoint>,
thickness: f32
) -> Self
pub fn new( context: &Context, pixel0: impl Into<PhysicalPoint>, pixel1: impl Into<PhysicalPoint>, thickness: f32 ) -> Self
Constructs a new line geometry.
sourcepub fn end_point0(&self) -> PhysicalPoint
pub fn end_point0(&self) -> PhysicalPoint
Get one of the end points of the line.
sourcepub fn end_point1(&self) -> PhysicalPoint
pub fn end_point1(&self) -> PhysicalPoint
Get one of the end points of the line.
sourcepub fn set_endpoints(
&mut self,
pixel0: impl Into<PhysicalPoint>,
pixel1: impl Into<PhysicalPoint>
)
pub fn set_endpoints( &mut self, pixel0: impl Into<PhysicalPoint>, pixel1: impl Into<PhysicalPoint> )
Change the two end points of the line. The pixel coordinates must be in physical pixels, where (viewport.x, viewport.y) indicate the top left corner of the viewport and (viewport.x + viewport.width, viewport.y + viewport.height) indicate the bottom right corner.
sourcepub fn set_thickness(&mut self, thickness: f32)
pub fn set_thickness(&mut self, thickness: f32)
Set the line thickness.
Methods from Deref<Target = Mesh>§
sourcepub fn transformation(&self) -> Mat4
pub fn transformation(&self) -> Mat4
Returns the local to world transformation applied to this mesh.
sourcepub fn set_transformation(&mut self, transformation: Mat4)
pub fn set_transformation(&mut self, transformation: Mat4)
Set the local to world transformation applied to this mesh. If any animation method is set using Self::set_animation, the transformation from that method is applied before this transformation.
sourcepub fn set_animation(
&mut self,
animation: impl Fn(f32) -> Mat4 + Send + Sync + 'static
)
pub fn set_animation( &mut self, animation: impl Fn(f32) -> Mat4 + Send + Sync + 'static )
Specifies a function which takes a time parameter as input and returns a transformation that should be applied to this mesh at the given time. To actually animate this mesh, call Geometry::animate at each frame which in turn evaluates the animation function defined by this method. This transformation is applied first, then the local to world transformation defined by Self::set_transformation.
sourcepub fn vertex_count(&self) -> u32
pub fn vertex_count(&self) -> u32
Returns the number of vertices in this mesh.
sourcepub fn update_positions(&mut self, positions: &[Vector3<f32>])
pub fn update_positions(&mut self, positions: &[Vector3<f32>])
Updates the vertex positions of the mesh.
§Panics
Panics if the number of positions does not match the number of vertices in the mesh.
sourcepub fn update_normals(&mut self, normals: &[Vector3<f32>])
pub fn update_normals(&mut self, normals: &[Vector3<f32>])
Updates the vertex normals of the mesh.
§Panics
Panics if the number of normals does not match the number of vertices in the mesh.
Trait Implementations§
source§impl Geometry for Line
impl Geometry for Line
source§fn draw(
&self,
camera: &Camera,
program: &Program,
render_states: RenderStates,
attributes: FragmentAttributes
)
fn draw( &self, camera: &Camera, program: &Program, render_states: RenderStates, attributes: FragmentAttributes )
source§fn vertex_shader_source(
&self,
required_attributes: FragmentAttributes
) -> String
fn vertex_shader_source( &self, required_attributes: FragmentAttributes ) -> String
source§fn id(&self, required_attributes: FragmentAttributes) -> u16
fn id(&self, required_attributes: FragmentAttributes) -> u16
Geometry::vertex_shader_source
. Read moresource§fn render_with_material(
&self,
material: &dyn Material,
camera: &Camera,
lights: &[&dyn Light]
)
fn render_with_material( &self, material: &dyn Material, camera: &Camera, lights: &[&dyn Light] )
lights
argument, if the material does not require lights to be rendered.source§fn render_with_effect(
&self,
material: &dyn Effect,
camera: &Camera,
lights: &[&dyn Light],
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>
)
fn render_with_effect( &self, material: &dyn Effect, camera: &Camera, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>> )
lights
argument, if the material does not require lights to be rendered.