Skip to content

Commit

Permalink
Make accessors for mesh vertices and indices public. (bevyengine#3906)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
nebkor authored and ItsDoot committed Feb 1, 2023
1 parent 2257821 commit 50661b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_render/src/mesh/mesh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -696,7 +696,7 @@ pub enum Indices {

impl Indices {
/// Returns an iterator over the indices.
fn iter(&self) -> impl Iterator<Item = usize> + '_ {
pub fn iter(&self) -> impl Iterator<Item = usize> + '_ {
match self {
Indices::U16(vec) => IndicesIter::U16(vec.iter()),
Indices::U32(vec) => IndicesIter::U32(vec.iter()),
Expand Down

0 comments on commit 50661b8

Please sign in to comment.