From 50661b859bc08976241b007496ce4b64bbf3a055 Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Mon, 9 May 2022 13:19:33 +0000 Subject: [PATCH] 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. --- crates/bevy_render/src/mesh/mesh/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_render/src/mesh/mesh/mod.rs b/crates/bevy_render/src/mesh/mesh/mod.rs index bcd0084cabb3d..12623a27be54a 100644 --- a/crates/bevy_render/src/mesh/mesh/mod.rs +++ b/crates/bevy_render/src/mesh/mesh/mod.rs @@ -607,7 +607,7 @@ impl VertexAttributeValues { } /// 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 { VertexAttributeValues::Float32x3(values) => Some(values), _ => None, @@ -696,7 +696,7 @@ pub enum Indices { impl Indices { /// Returns an iterator over the indices. - fn iter(&self) -> impl Iterator + '_ { + pub fn iter(&self) -> impl Iterator + '_ { match self { Indices::U16(vec) => IndicesIter::U16(vec.iter()), Indices::U32(vec) => IndicesIter::U32(vec.iter()),