Skip to main content

mln_engine/draw/
range.rs

1/// What one draw call of a mesh draws: `index_count` of the mesh's indexes
2/// from `first_index`, each counted from the vertex `base_vertex`, for
3/// `instance_count` instances from `first_instance`. A range without
4/// indexes draws nothing.
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub struct DrawRange {
7    pub first_index: u32,
8    pub index_count: u32,
9    pub base_vertex: i32,
10    pub first_instance: u32,
11    pub instance_count: u32,
12}
13
14impl DrawRange {
15    /// The first `index_count` indexes, from the first vertex, of one
16    /// instance.
17    #[must_use]
18    pub const fn indexes(index_count: usize) -> DrawRange {
19        DrawRange {
20            first_index: 0,
21            index_count: index_count as u32,
22            base_vertex: 0,
23            first_instance: 0,
24            instance_count: 1,
25        }
26    }
27}