diff options
Diffstat (limited to 'opengl-bindings/src/data_types.rs')
-rw-r--r-- | opengl-bindings/src/data_types.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/opengl-bindings/src/data_types.rs b/opengl-bindings/src/data_types.rs new file mode 100644 index 0000000..7ead0ab --- /dev/null +++ b/opengl-bindings/src/data_types.rs @@ -0,0 +1,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, +} |