mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-04 09:58:27 +00:00
Add Mesh::vertices
This commit is contained in:
parent
924e9a03d4
commit
7146ce45a6
@ -4,7 +4,7 @@ use crate::mesh::Mesh;
|
||||
|
||||
pub fn export(mesh: &Mesh) -> anyhow::Result<()> {
|
||||
let vertices = mesh
|
||||
.vertices
|
||||
.vertices()
|
||||
.iter()
|
||||
.copied()
|
||||
.map(|vertex| vertex.map(Into::into))
|
||||
|
@ -5,6 +5,10 @@ pub struct Mesh {
|
||||
}
|
||||
|
||||
impl Mesh {
|
||||
pub fn vertices(&self) -> &[[f32; 3]] {
|
||||
&self.vertices
|
||||
}
|
||||
|
||||
pub fn push_vertex(&mut self, vertex: [f32; 3]) {
|
||||
self.vertices.push(vertex);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ impl Renderer {
|
||||
self.device
|
||||
.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
label: None,
|
||||
contents: bytemuck::cast_slice(&mesh.vertices),
|
||||
contents: bytemuck::cast_slice(&mesh.vertices()),
|
||||
usage: wgpu::BufferUsages::VERTEX,
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user