mirror of
https://github.com/hannobraun/Fornjot
synced 2025-10-06 07:58:11 +00:00
Split module into simpler ones
This commit is contained in:
parent
0b3ede5383
commit
4e3c0deda2
@ -5,7 +5,7 @@ use wgpu::util::DeviceExt;
|
||||
|
||||
use crate::geometry::Operation;
|
||||
|
||||
use super::pipelines::{TrianglesVertex, VerticesVertex};
|
||||
use super::pipelines::{triangles::TrianglesVertex, vertices::VerticesVertex};
|
||||
|
||||
pub struct Geometry<V> {
|
||||
pub vertices: wgpu::Buffer,
|
||||
|
@ -1,14 +1,15 @@
|
||||
mod pipeline;
|
||||
|
||||
pub mod triangles;
|
||||
pub mod vertices;
|
||||
|
||||
use glam::Mat4;
|
||||
|
||||
pub use self::pipeline::Pipeline;
|
||||
|
||||
use self::pipeline::Vertex;
|
||||
|
||||
pub struct Pipelines {
|
||||
pub vertices: Pipeline<VerticesVertex>,
|
||||
pub triangles: Pipeline<TrianglesVertex>,
|
||||
pub vertices: Pipeline<vertices::VerticesVertex>,
|
||||
pub triangles: Pipeline<triangles::TrianglesVertex>,
|
||||
}
|
||||
|
||||
impl Pipelines {
|
||||
@ -54,33 +55,3 @@ impl Uniforms {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
#[repr(C)]
|
||||
pub struct TrianglesVertex {
|
||||
pub position: [f32; 3],
|
||||
pub normal: [f32; 3],
|
||||
}
|
||||
|
||||
impl Vertex for TrianglesVertex {
|
||||
const ATTRIBUTES: &[wgpu::VertexAttribute] = &wgpu::vertex_attr_array![
|
||||
0 => Float32x3,
|
||||
1 => Float32x3,
|
||||
];
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
#[repr(C)]
|
||||
pub struct VerticesVertex {
|
||||
pub position: [f32; 3],
|
||||
pub center: [f32; 3],
|
||||
pub radius: f32,
|
||||
}
|
||||
|
||||
impl Vertex for VerticesVertex {
|
||||
const ATTRIBUTES: &[wgpu::VertexAttribute] = &wgpu::vertex_attr_array![
|
||||
0 => Float32x3,
|
||||
1 => Float32x3,
|
||||
2 => Float32,
|
||||
];
|
||||
}
|
||||
|
15
experiments/2024-10-30/src/render/pipelines/triangles.rs
Normal file
15
experiments/2024-10-30/src/render/pipelines/triangles.rs
Normal file
@ -0,0 +1,15 @@
|
||||
use super::pipeline::Vertex;
|
||||
|
||||
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
#[repr(C)]
|
||||
pub struct TrianglesVertex {
|
||||
pub position: [f32; 3],
|
||||
pub normal: [f32; 3],
|
||||
}
|
||||
|
||||
impl Vertex for TrianglesVertex {
|
||||
const ATTRIBUTES: &[wgpu::VertexAttribute] = &wgpu::vertex_attr_array![
|
||||
0 => Float32x3,
|
||||
1 => Float32x3,
|
||||
];
|
||||
}
|
17
experiments/2024-10-30/src/render/pipelines/vertices.rs
Normal file
17
experiments/2024-10-30/src/render/pipelines/vertices.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use super::pipeline::Vertex;
|
||||
|
||||
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
#[repr(C)]
|
||||
pub struct VerticesVertex {
|
||||
pub position: [f32; 3],
|
||||
pub center: [f32; 3],
|
||||
pub radius: f32,
|
||||
}
|
||||
|
||||
impl Vertex for VerticesVertex {
|
||||
const ATTRIBUTES: &[wgpu::VertexAttribute] = &wgpu::vertex_attr_array![
|
||||
0 => Float32x3,
|
||||
1 => Float32x3,
|
||||
2 => Float32,
|
||||
];
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user