mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 06:30:19 +00:00
Mutable mesh accessors: indices_mut and attribute_mut (#1164)
mutable mesh accessors: indices_mut and attribute_mut
This commit is contained in:
parent
871b47f1c3
commit
2754a9dde8
1 changed files with 11 additions and 0 deletions
|
@ -219,6 +219,13 @@ impl Mesh {
|
|||
self.attributes.get(&name.into())
|
||||
}
|
||||
|
||||
pub fn attribute_mut(
|
||||
&mut self,
|
||||
name: impl Into<Cow<'static, str>>,
|
||||
) -> Option<&mut VertexAttributeValues> {
|
||||
self.attributes.get_mut(&name.into())
|
||||
}
|
||||
|
||||
pub fn set_indices(&mut self, indices: Option<Indices>) {
|
||||
self.indices = indices;
|
||||
}
|
||||
|
@ -227,6 +234,10 @@ impl Mesh {
|
|||
self.indices.as_ref()
|
||||
}
|
||||
|
||||
pub fn indices_mut(&mut self) -> Option<&mut Indices> {
|
||||
self.indices.as_mut()
|
||||
}
|
||||
|
||||
pub fn get_index_buffer_bytes(&self) -> Option<Vec<u8>> {
|
||||
self.indices.as_ref().map(|indices| match &indices {
|
||||
Indices::U16(indices) => indices.as_slice().as_bytes().to_vec(),
|
||||
|
|
Loading…
Reference in a new issue