Make accessors for mesh vertices and indices public. (#3906)

# Objective

Make it easy to get position and index data from Meshes.

## Solution

It was previously possible to get the mesh data by manually matching on `Mesh::VertexAttributeValues` and `Mesh::Indices`as in the bodies of these two methods (`VertexAttributeValues::as_float3(&self)` and `Indices::iter(&self)`), but that's needless duplication that making these methods `pub` fixes.
This commit is contained in:
Joe Ardent 2022-05-09 13:19:33 +00:00
parent 89f4943157
commit 96078c76eb

View File

@ -607,7 +607,7 @@ impl VertexAttributeValues {
} }
/// Returns the values as float triples if possible. /// Returns the values as float triples if possible.
fn as_float3(&self) -> Option<&[[f32; 3]]> { pub fn as_float3(&self) -> Option<&[[f32; 3]]> {
match self { match self {
VertexAttributeValues::Float32x3(values) => Some(values), VertexAttributeValues::Float32x3(values) => Some(values),
_ => None, _ => None,
@ -696,7 +696,7 @@ pub enum Indices {
impl Indices { impl Indices {
/// Returns an iterator over the indices. /// Returns an iterator over the indices.
fn iter(&self) -> impl Iterator<Item = usize> + '_ { pub fn iter(&self) -> impl Iterator<Item = usize> + '_ {
match self { match self {
Indices::U16(vec) => IndicesIter::U16(vec.iter()), Indices::U16(vec) => IndicesIter::U16(vec.iter()),
Indices::U32(vec) => IndicesIter::U32(vec.iter()), Indices::U32(vec) => IndicesIter::U32(vec.iter()),