use crate::{error::MeshTextError, BoundingBox, TriangleMesh};
pub struct MeshText {
pub bbox: BoundingBox,
pub vertices: Vec<f32>,
}
impl MeshText {
pub fn new(vertices: Vec<f32>) -> Result<Self, Box<dyn MeshTextError>> {
let bbox = BoundingBox::from_vertices(&vertices)?;
Ok(Self { bbox, vertices })
}
}
impl TriangleMesh for MeshText {
fn bbox(&self) -> BoundingBox {
self.bbox
}
fn indices(&self) -> Option<Vec<u32>> {
None
}
fn vertices(&self) -> Vec<f32> {
self.vertices.clone()
}
}