mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-05 10:28: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<()> {
|
pub fn export(mesh: &Mesh) -> anyhow::Result<()> {
|
||||||
let vertices = mesh
|
let vertices = mesh
|
||||||
.vertices
|
.vertices()
|
||||||
.iter()
|
.iter()
|
||||||
.copied()
|
.copied()
|
||||||
.map(|vertex| vertex.map(Into::into))
|
.map(|vertex| vertex.map(Into::into))
|
||||||
|
@ -5,6 +5,10 @@ pub struct Mesh {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Mesh {
|
impl Mesh {
|
||||||
|
pub fn vertices(&self) -> &[[f32; 3]] {
|
||||||
|
&self.vertices
|
||||||
|
}
|
||||||
|
|
||||||
pub fn push_vertex(&mut self, vertex: [f32; 3]) {
|
pub fn push_vertex(&mut self, vertex: [f32; 3]) {
|
||||||
self.vertices.push(vertex);
|
self.vertices.push(vertex);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ impl Renderer {
|
|||||||
self.device
|
self.device
|
||||||
.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||||
label: None,
|
label: None,
|
||||||
contents: bytemuck::cast_slice(&mesh.vertices),
|
contents: bytemuck::cast_slice(&mesh.vertices()),
|
||||||
usage: wgpu::BufferUsages::VERTEX,
|
usage: wgpu::BufferUsages::VERTEX,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user