Skip to content

Commit

Permalink
Add getters to Mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
17cupsofcoffee committed Nov 27, 2020
1 parent 62c9a26 commit 918a0d6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/graphics/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,23 @@ impl Mesh {
}
}

/// Gets a reference to the vertex buffer contained within this mesh.
pub fn vertex_buffer(&self) -> &VertexBuffer {
&self.vertex_buffer
}

/// Sets the vertex buffer that will be used when drawing the mesh.
pub fn set_vertex_buffer(&mut self, vertex_buffer: VertexBuffer) {
self.vertex_buffer = vertex_buffer;
}

/// Gets a reference to the index buffer contained within this mesh.
///
/// Returns [`None`] if this mesh does not currently have an index buffer attatched.
pub fn index_buffer(&self) -> Option<&IndexBuffer> {
self.index_buffer.as_ref()
}

/// Sets the index buffer that will be used when drawing the mesh.
pub fn set_index_buffer(&mut self, index_buffer: IndexBuffer) {
self.index_buffer = Some(index_buffer);
Expand All @@ -283,6 +295,13 @@ impl Mesh {
self.index_buffer = None;
}

/// Gets a reference to the texture contained within this mesh.
///
/// Returns [`None`] if this mesh does not currently have an texture attatched.
pub fn texture(&self) -> Option<&Texture> {
self.texture.as_ref()
}

/// Sets the texture that will be used when drawing the mesh.
pub fn set_texture(&mut self, texture: Texture) {
self.texture = Some(texture);
Expand Down

0 comments on commit 918a0d6

Please sign in to comment.