Struct crystal_ball::shapes::TriangleMesh
source · pub struct TriangleMesh {
pub indices: Vec<u32>,
pub vertices: Vec<Point3>,
pub normals: Vec<Vec3>,
pub tangents: Vec<Vec4>,
pub uvs: Vec<Point2>,
}
Expand description
A mesh consisting of multiple triangles.
When applying transformations such as Transformable::rotate_x
,
TriangleMesh::vertex_mean
is used as the origin.
This struct does not store any Triangle
s directly.
Instead it contains the necessary buffers to create the individual triangles.
Fields§
§indices: Vec<u32>
§vertices: Vec<Point3>
§normals: Vec<Vec3>
§tangents: Vec<Vec4>
§uvs: Vec<Point2>
Implementations§
source§impl TriangleMesh
impl TriangleMesh
sourcepub fn new(
indices: Vec<u32>,
vertices: Vec<Point3>,
normals: Vec<Vec3>,
tangents: Vec<Vec4>,
uvs: Vec<Point2>
) -> Self
pub fn new( indices: Vec<u32>, vertices: Vec<Point3>, normals: Vec<Vec3>, tangents: Vec<Vec4>, uvs: Vec<Point2> ) -> Self
Create a new TriangleMesh
.
sourcepub fn triangle(leg_length: f64) -> TriangleMesh
pub fn triangle(leg_length: f64) -> TriangleMesh
Create a new TriangleMesh
consisting of a single triangle.
sourcepub fn plane(half_size: f64) -> TriangleMesh
pub fn plane(half_size: f64) -> TriangleMesh
Create a new TriangleMesh
consisting of a single plane.
sourcepub fn cube(half_size: f64) -> TriangleMesh
pub fn cube(half_size: f64) -> TriangleMesh
Create a new TriangleMesh
consisting of a single cube.
sourcepub fn vertex_mean(&self) -> Point3
pub fn vertex_mean(&self) -> Point3
Calculate the triangle mesh’s vertex mean.
Trait Implementations§
source§impl Clone for TriangleMesh
impl Clone for TriangleMesh
source§fn clone(&self) -> TriangleMesh
fn clone(&self) -> TriangleMesh
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Transformable for TriangleMesh
impl Transformable for TriangleMesh
source§fn look_at(self, _target: Point3, _view_up: Vec3) -> Self
fn look_at(self, _target: Point3, _view_up: Vec3) -> Self
This method is currently not implemented.
source§fn rotate_x(self, angle: f64) -> Self
fn rotate_x(self, angle: f64) -> Self
Rotate
self
around its center along the +X axis. Read moresource§fn rotate_y(self, angle: f64) -> Self
fn rotate_y(self, angle: f64) -> Self
Rotate
self
around its center along the +Y axis. Read moresource§fn rotate_z(self, angle: f64) -> Self
fn rotate_z(self, angle: f64) -> Self
Rotate
self
around its center along the +Z axis. Read moreAuto Trait Implementations§
impl RefUnwindSafe for TriangleMesh
impl Send for TriangleMesh
impl Sync for TriangleMesh
impl Unpin for TriangleMesh
impl UnwindSafe for TriangleMesh
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