Struct truck_polymesh::polygon_mesh::PolygonMeshEditor[][src]

pub struct PolygonMeshEditor<'a> {
    pub positions: &'a mut Vec<Point3>,
    pub uv_coords: &'a mut Vec<Vector2>,
    pub normals: &'a mut Vec<Vector3>,
    pub faces: &'a mut Faces,
    // some fields omitted
}

Editor of polygon mesh

It has mutable references to all member variables of the polygon mesh as public variables, allowing for any destructive changes for optimization. At drop time, the indices of each vertex are judged to be within the range of the array of attributes, and a panic occurs if there is one outside the range (boundary check).

Examples

use truck_polymesh::*;

let positions = vec![
    Point3::new(1.0, 0.0, 0.0),
    Point3::new(0.0, 1.0, 0.0),
    Point3::new(0.0, 0.0, 1.0),
];
let faces = Faces::from_iter(&[[0, 1, 2]]);
let mut mesh = PolygonMesh::new(positions, Vec::new(), Vec::new(), faces);

// create editor
let editor = mesh.editor();

// destructive changes
editor.uv_coords.push(Vector2::new(0.0, 0.0));
editor.faces.tri_faces_mut()[0][0].uv = Some(0);
use truck_polymesh::*;

let positions = vec![
    Point3::new(1.0, 0.0, 0.0),
    Point3::new(0.0, 1.0, 0.0),
    Point3::new(0.0, 0.0, 1.0),
];
let faces = Faces::from_iter(&[[0, 1, 2]]);
let mut mesh = PolygonMesh::new(positions, Vec::new(), Vec::new(), faces);

// create editor
let editor = mesh.editor();

// destructive changes
editor.faces.tri_faces_mut()[0][0].uv = Some(0);

// Panic occurs since no uv coord is added.

Fields

positions: &'a mut Vec<Point3>

mutable reference to the vector of positions

uv_coords: &'a mut Vec<Vector2>

mutable reference to the vector of uv coordinates

normals: &'a mut Vec<Vector3>

mutable reference to the vector of normals

faces: &'a mut Faces

mutable reference to the faces of the polygon mesh

Trait Implementations

impl<'a> Debug for PolygonMeshEditor<'a>[src]

impl<'a> Drop for PolygonMeshEditor<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for PolygonMeshEditor<'a>

impl<'a> Send for PolygonMeshEditor<'a>

impl<'a> Sync for PolygonMeshEditor<'a>

impl<'a> Unpin for PolygonMeshEditor<'a>

impl<'a> !UnwindSafe for PolygonMeshEditor<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.