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
sourceimpl 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
sourceimpl DowncastObject for Mesh
impl DowncastObject for Mesh
sourcefn 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 moresourceimpl Object for Mesh
impl Object for Mesh
sourcefn resolve_data(&self, _: &SyncGuard<'_>) -> Self::Data
fn resolve_data(&self, _: &SyncGuard<'_>) -> Self::Data
Retrieves the internal data for the object. Read more
sourcefn set_visible(&self, visible: bool)
fn set_visible(&self, visible: bool)
Invisible objects are not rendered by cameras.
sourcefn set_transform<P, Q>(&self, pos: P, rot: Q, scale: f32)where
Self: Sized,
P: Into<Point3<f32>>,
Q: Into<Quaternion<f32>>,
fn set_transform<P, Q>(&self, pos: P, rot: Q, scale: f32)where
Self: Sized,
P: Into<Point3<f32>>,
Q: Into<Quaternion<f32>>,
Set both position, orientation and scale.
sourcefn set_orientation<Q>(&self, rot: Q)where
Self: Sized,
Q: Into<Quaternion<f32>>,
fn set_orientation<Q>(&self, rot: Q)where
Self: Sized,
Q: Into<Quaternion<f32>>,
Set orientation.
sourcefn set_weights(&self, weights: Vec<f32>)
fn set_weights(&self, weights: Vec<f32>)
Set weights.
impl Eq for Mesh
impl StructuralEq for Mesh
impl StructuralPartialEq for Mesh
Auto Trait Implementations
impl !RefUnwindSafe for Mesh
impl !Send for Mesh
impl !Sync for Mesh
impl Unpin for Mesh
impl !UnwindSafe for Mesh
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
Sets
value
as a parameter of self
.