summaryrefslogtreecommitdiff
path: root/opengl-bindings/src/data_types.rs
blob: 7ead0ab658c96c71743f4960eb2d34005ac9d180 (plain)
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
use safer_ffi::derive_ReprC;
use safer_ffi::layout::ReprC;

#[derive(Debug, Clone)]
#[derive_ReprC]
#[repr(C)]
pub struct Matrix<Value: ReprC, const ROWS: usize, const COLUMNS: usize>
{
    /// Items must be layed out this way for it to work with OpenGL shaders.
    pub items: [[Value; ROWS]; COLUMNS],
}

#[derive(Debug, Clone)]
#[derive_ReprC]
#[repr(C)]
pub struct Vec3<Value: ReprC>
{
    pub x: Value,
    pub y: Value,
    pub z: Value,
}

#[derive(Debug, Clone)]
#[derive_ReprC]
#[repr(C)]
pub struct Vec2<Value>
{
    pub x: Value,
    pub y: Value,
}

#[derive(Debug, Clone)]
pub struct Dimens<Value>
{
    pub width: Value,
    pub height: Value,
}