pub struct PyMeshRenderer {
pub vertices: Vec<f64>,
pub normals: Vec<f64>,
pub indices: Vec<u32>,
pub material: PyMaterial,
pub scalars: Option<Vec<f64>>,
}Expand description
GPU-ready mesh data with material and optional per-vertex scalar field.
Fields§
§vertices: Vec<f64>Flat array of vertex positions: [x0, y0, z0, x1, y1, z1, …].
normals: Vec<f64>Flat array of vertex normals (same length as vertices).
indices: Vec<u32>Triangle index list (3 indices per triangle).
material: PyMaterialSurface material.
scalars: Option<Vec<f64>>Optional per-vertex scalar values for colormap coloring.
Implementations§
Source§impl PyMeshRenderer
impl PyMeshRenderer
Sourcepub fn new(vertices: Vec<f64>, indices: Vec<u32>, material: PyMaterial) -> Self
pub fn new(vertices: Vec<f64>, indices: Vec<u32>, material: PyMaterial) -> Self
Create a new mesh renderer from raw geometry.
Sourcepub fn apply_colormap(&mut self, scalars: Vec<f64>, colormap: PyColormap)
pub fn apply_colormap(&mut self, scalars: Vec<f64>, colormap: PyColormap)
Apply a colormap to per-vertex scalar values.
Sets material.colormap and stores the scalar array.
Sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
Returns the number of vertices.
Sourcepub fn triangle_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Returns the number of triangles.
Sourcepub fn recompute_normals(&mut self)
pub fn recompute_normals(&mut self)
Recompute normals from current vertex/index data.
Trait Implementations§
Source§impl Clone for PyMeshRenderer
impl Clone for PyMeshRenderer
Source§fn clone(&self) -> PyMeshRenderer
fn clone(&self) -> PyMeshRenderer
Returns a duplicate 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 Debug for PyMeshRenderer
impl Debug for PyMeshRenderer
Source§impl<'de> Deserialize<'de> for PyMeshRenderer
impl<'de> Deserialize<'de> for PyMeshRenderer
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PyMeshRenderer
impl RefUnwindSafe for PyMeshRenderer
impl Send for PyMeshRenderer
impl Sync for PyMeshRenderer
impl Unpin for PyMeshRenderer
impl UnsafeUnpin for PyMeshRenderer
impl UnwindSafe for PyMeshRenderer
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.