pub struct Wireframe { /* private fields */ }Expand description
Renders a triangle mesh as a screen-space wireframe.
The wireframe is generated from per-vertex barycentric coordinates and drawn on top of triangle faces in the fragment shader.
Implementations§
Source§impl Wireframe
impl Wireframe
Sourcepub fn new(
context: &Context,
positions: &[Vec3],
wire_width: f32,
wire_color: Srgba,
) -> Self
pub fn new( context: &Context, positions: &[Vec3], wire_width: f32, wire_color: Srgba, ) -> Self
Creates a new wireframe object from vertex positions
Sourcepub fn new_from_cpu_mesh(
context: &Context,
cpu_mesh: &CpuMesh,
wire_width: f32,
wire_color: Srgba,
) -> Self
pub fn new_from_cpu_mesh( context: &Context, cpu_mesh: &CpuMesh, wire_width: f32, wire_color: Srgba, ) -> Self
Creates a new wireframe object from a CPU mesh.
Sourcepub fn new_from_cpu_model(
context: &Context,
cpu_model: &CpuModel,
wire_width: f32,
wire_color: Srgba,
) -> Vec<Self>
pub fn new_from_cpu_model( context: &Context, cpu_model: &CpuModel, wire_width: f32, wire_color: Srgba, ) -> Vec<Self>
Creates a new wireframe object from a CPU model.
Sourcepub fn set_transformation(&mut self, transformation: Mat4)
pub fn set_transformation(&mut self, transformation: Mat4)
Sets the model transformation applied when rendering.
Sourcepub fn set_wire_width(&mut self, width: f32)
pub fn set_wire_width(&mut self, width: f32)
Sets the wire thickness.
Sourcepub fn set_wire_color(&mut self, color: Srgba)
pub fn set_wire_color(&mut self, color: Srgba)
Sets the wire color.
Trait Implementations§
Source§impl Geometry for Wireframe
impl Geometry for Wireframe
Source§fn draw(
&self,
viewer: &dyn Viewer,
program: &Program,
render_states: RenderStates,
)
fn draw( &self, viewer: &dyn Viewer, program: &Program, render_states: RenderStates, )
Draw this geometry.
Source§fn vertex_shader_source(&self) -> String
fn vertex_shader_source(&self) -> String
Returns the vertex shader source for this geometry given that the fragment shader needs the given vertex attributes.
Source§fn id(&self) -> GeometryId
fn id(&self) -> GeometryId
Returns a unique ID for each variation of the shader source returned from
Geometry::vertex_shader_source. Read moreSource§fn render_with_material(
&self,
material: &dyn Material,
viewer: &dyn Viewer,
lights: &[&dyn Light],
)
fn render_with_material( &self, material: &dyn Material, viewer: &dyn Viewer, lights: &[&dyn Light], )
Render the geometry with the given Material.
Must be called in the callback given as input to a RenderTarget, ColorTarget or DepthTarget write method.
Use an empty array for the
lights argument, if the material does not require lights to be rendered.Source§fn render_with_effect(
&self,
material: &dyn Effect,
viewer: &dyn Viewer,
lights: &[&dyn Light],
color_texture: Option<ColorTexture<'_>>,
depth_texture: Option<DepthTexture<'_>>,
)
fn render_with_effect( &self, material: &dyn Effect, viewer: &dyn Viewer, lights: &[&dyn Light], color_texture: Option<ColorTexture<'_>>, depth_texture: Option<DepthTexture<'_>>, )
Render the geometry with the given Effect.
Must be called in the callback given as input to a RenderTarget, ColorTarget or DepthTarget write method.
Use an empty array for the
lights argument, if the material does not require lights to be rendered.Source§fn aabb(&self) -> AxisAlignedBoundingBox
fn aabb(&self) -> AxisAlignedBoundingBox
Returns the AxisAlignedBoundingBox for this geometry in the global coordinate system.
Source§impl<'a> IntoIterator for &'a Wireframe
impl<'a> IntoIterator for &'a Wireframe
Source§impl Object for Wireframe
impl Object for Wireframe
Source§fn render(&self, viewer: &dyn Viewer, lights: &[&dyn Light])
fn render(&self, viewer: &dyn Viewer, lights: &[&dyn Light])
Render the object.
Use an empty array for the
lights argument, if the objects does not require lights to be rendered.
Must be called in the callback given as input to a RenderTarget, ColorTarget or DepthTarget write method.Source§fn material_type(&self) -> MaterialType
fn material_type(&self) -> MaterialType
Returns the type of material applied to this object.
Auto Trait Implementations§
impl Freeze for Wireframe
impl RefUnwindSafe for Wireframe
impl Send for Wireframe
impl Sync for Wireframe
impl Unpin for Wireframe
impl UnsafeUnpin for Wireframe
impl UnwindSafe for Wireframe
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
Mutably borrows from an owned value. Read more