Cleanup of UV space handling
This commit is contained in:
1 parent
8d17f8e64f
commit
7b925876a5
9 files changed
+73
-118
No files matched your search
@@ -0,0 +1,36 @@
|
||||
use crate::math::{Point, Quad, Rect, Size};
|
||||
|
||||
pub struct UvSpace;
|
||||
|
||||
pub type UvPoint = Point<f32, UvSpace>;
|
||||
pub type UvRect = Rect<f32, UvSpace>;
|
||||
pub type UvQuad = Quad<f32, UvSpace>;
|
||||
|
||||
pub trait UvConstructors {
|
||||
fn full_uv() -> Self;
|
||||
fn white_uv() -> Self;
|
||||
}
|
||||
|
||||
impl UvConstructors for UvRect {
|
||||
#[inline]
|
||||
fn full_uv() -> Self {
|
||||
Self::from_size(Size::new(1.0, 1.0))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn white_uv() -> Self {
|
||||
Self::zero()
|
||||
}
|
||||
}
|
||||
|
||||
impl UvConstructors for UvQuad {
|
||||
#[inline]
|
||||
fn full_uv() -> Self {
|
||||
Self::from_size(Size::new(1.0, 1.0))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn white_uv() -> Self {
|
||||
Self::zero()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user