pub struct Mesh { /* private fields */ }
Expand description
§Examples
Creating a solid red triangle.
let vertices = vec![
[-0.5, -0.5, 0.0].into(),
[ 0.5, -0.5, 0.0].into(),
[ 0.5, -0.5, 0.0].into(),
];
let geometry = three::Geometry::with_vertices(vertices);
let red_material = three::material::Basic { color: three::color::RED, map: None };
let mesh = factory.mesh(geometry, red_material);
Duplicating a mesh.
use three::Object;
let mut duplicate = factory.mesh_instance(&mesh);
// Duplicated meshes share their geometry but may be transformed individually.
duplicate.set_position([1.2, 3.4, 5.6]);
Duplicating a mesh with a different material.
let yellow_material = three::material::Wireframe { color: three::color::YELLOW };
let mut duplicate = factory.mesh_instance_with_material(&mesh, yellow_material);
duplicate.set_position([1.2, 3.4, 5.6]);
§Notes
- Meshes are removed from the scene when dropped.
- Hence, meshes must be kept in scope in order to be displayed.
Implementations§
Source§impl Mesh
impl Mesh
Sourcepub fn set_material<M: Into<Material>>(&self, material: M)
pub fn set_material<M: Into<Material>>(&self, material: M)
Set mesh material.
Sourcepub fn set_skeleton(&self, skeleton: Skeleton)
pub fn set_skeleton(&self, skeleton: Skeleton)
Bind a skeleton to the mesh.
Trait Implementations§
Source§impl DowncastObject for Mesh
impl DowncastObject for Mesh
Source§fn downcast(object_type: ObjectType) -> Option<Mesh>
fn downcast(object_type: ObjectType) -> Option<Mesh>
Attempts to extract the concrete type of the object from an
ObjectType
. Read moreSource§impl Object for Mesh
impl Object for Mesh
Source§fn resolve_data(&self, _: &SyncGuard<'_>) -> Self::Data
fn resolve_data(&self, _: &SyncGuard<'_>) -> Self::Data
Retrieves the internal data for the object. Read more
Source§fn set_visible(&self, visible: bool)
fn set_visible(&self, visible: bool)
Invisible objects are not rendered by cameras.
Source§fn set_transform<P, Q>(&self, pos: P, rot: Q, scale: f32)
fn set_transform<P, Q>(&self, pos: P, rot: Q, scale: f32)
Set both position, orientation and scale.
Source§fn set_orientation<Q>(&self, rot: Q)
fn set_orientation<Q>(&self, rot: Q)
Set orientation.
Source§fn set_weights(&self, weights: Vec<f32>)
fn set_weights(&self, weights: Vec<f32>)
Set weights.
impl Eq for Mesh
impl StructuralPartialEq for Mesh
Auto Trait Implementations§
impl Freeze for Mesh
impl !RefUnwindSafe for Mesh
impl !Send for Mesh
impl !Sync for Mesh
impl Unpin for Mesh
impl !UnwindSafe for Mesh
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more