60 lines
810 B
Rust
60 lines
810 B
Rust
use crate::vector::Vector;
|
|
use crate::matrix::Matrix;
|
|
|
|
#[repr(C)]
|
|
pub struct Vector2<T> {
|
|
pub x: T,
|
|
pub y: T,
|
|
}
|
|
#[repr(C)]
|
|
pub struct Vector3<T> {
|
|
pub x: T,
|
|
pub y: T,
|
|
pub z: T,
|
|
}
|
|
#[repr(C)]
|
|
pub struct Vector4<T> {
|
|
pub x: T,
|
|
pub y: T,
|
|
pub z: T,
|
|
pub w: T,
|
|
}
|
|
|
|
crate::impl_vector_named_fields!(Vector2, 2);
|
|
crate::impl_vector_named_fields!(Vector3, 3);
|
|
crate::impl_vector_named_fields!(Vector4, 4);
|
|
|
|
#[repr(C)]
|
|
pub struct Matrix2<T> {
|
|
pub x_axis: T,
|
|
pub y_axis: T,
|
|
}
|
|
#[repr(C)]
|
|
pub struct Matrix3<T> {
|
|
pub x_axis: T,
|
|
pub y_axis: T,
|
|
pub z_axis: T,
|
|
}
|
|
#[repr(C)]
|
|
pub struct Matrix4<T> {
|
|
pub x_axis: T,
|
|
pub y_axis: T,
|
|
pub z_axis: T,
|
|
pub w_axis: T,
|
|
}
|
|
|
|
crate::impl_matrix_named_fields!(
|
|
//outer struct
|
|
(
|
|
(Matrix2, 2),
|
|
(Matrix3, 3),
|
|
(Matrix4, 4)
|
|
),
|
|
//inner struct
|
|
(
|
|
(2),
|
|
(3),
|
|
(4)
|
|
)
|
|
);
|