threers 0.0.2

Drop-in three.js replacement for Rust and WebAssembly (wgpu) — THREE.* API, scene graph, PBR, post-fx, mesh BVH, CSG, headless render, and native media codecs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// A typed vertex attribute, equivalent to three.js's `BufferAttribute`.
///
/// `item_size` is the number of components per vertex (e.g. 3 for position).
#[derive(Debug, Clone)]
pub struct BufferAttribute {
    pub array: Vec<f32>,
    pub item_size: usize,
}

impl BufferAttribute {
    pub fn new(array: Vec<f32>, item_size: usize) -> Self {
        Self { array, item_size }
    }

    pub fn count(&self) -> usize {
        self.array.len() / self.item_size
    }
}