1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use super::{AttributeKind, DataKind};

#[derive(Debug, Clone, Hash)]
pub struct GLAttribute {
    kind: AttributeKind,
    count: usize,
    item_count: usize,
    item_kind: DataKind,
    location: usize,
}

impl GLAttribute {
    #[inline]
    pub fn new(kind: AttributeKind, count: usize, location: usize) -> Self {
        let (item_count, item_kind) = kind.item_data();

        GLAttribute {
            kind: kind,
            count: count,
            item_count: item_count,
            item_kind: item_kind,
            location: location,
        }
    }

    #[inline(always)]
    pub fn kind(&self) -> AttributeKind {
        self.kind
    }
    #[inline(always)]
    pub fn count(&self) -> usize {
        self.count
    }
    #[inline(always)]
    pub fn item_count(&self) -> usize {
        self.item_count
    }
    #[inline(always)]
    pub fn item_kind(&self) -> DataKind {
        self.item_kind
    }
    #[inline(always)]
    pub fn location(&self) -> usize {
        self.location
    }
}