forked from 1b-agent/opencadstudio-upstream
29 lines
970 B
Rust
29 lines
970 B
Rust
// Triangle mesh model — produced by truck Shell/Solid tessellation.
|
|
//
|
|
// Stored alongside WireModels in the scene; rendered by the mesh pipeline
|
|
// (wgpu TriangleList with depth test, flat normals).
|
|
|
|
/// A tessellated triangle mesh ready to upload to the GPU.
|
|
#[derive(Clone, Debug)]
|
|
#[allow(dead_code)]
|
|
pub struct MeshModel {
|
|
/// Unique identifier (entity handle value as decimal string).
|
|
pub name: String,
|
|
/// World-space vertex positions.
|
|
pub verts: Vec<[f32; 3]>,
|
|
/// Per-vertex normals (may be empty if not available).
|
|
pub normals: Vec<[f32; 3]>,
|
|
/// Triangle indices into `verts` (every 3 values = one triangle).
|
|
pub indices: Vec<u32>,
|
|
/// RGBA colour in [0, 1].
|
|
pub color: [f32; 4],
|
|
/// Whether this mesh is currently selected.
|
|
pub selected: bool,
|
|
}
|
|
|
|
impl MeshModel {
|
|
#[allow(dead_code)]
|
|
pub const WHITE: [f32; 4] = [1.00, 1.00, 1.00, 1.0];
|
|
pub const SELECTED: [f32; 4] = [0.15, 0.55, 1.00, 1.0];
|
|
}
|