doc(rt): doc scaling

This commit is contained in:
chyyran 2023-02-08 00:04:46 -05:00
parent 59e0b5da86
commit 4947eff4d1

View file

@ -5,6 +5,7 @@ use librashader_presets::{Scale2D, ScaleFactor, ScaleType, Scaling};
use num_traits::AsPrimitive; use num_traits::AsPrimitive;
use std::ops::Mul; use std::ops::Mul;
/// Trait for size scaling relative to the viewport.
pub trait ViewportSize<T> pub trait ViewportSize<T>
where where
T: Mul<ScaleFactor, Output = f32> + Copy + 'static, T: Mul<ScaleFactor, Output = f32> + Copy + 'static,
@ -28,10 +29,12 @@ where
} }
} }
/// Trait for size scaling relating to mipmap generation.
pub trait MipmapSize<T> { pub trait MipmapSize<T> {
/// Calculate the number of mipmap levels for a given size. /// Calculate the number of mipmap levels for a given size.
fn calculate_miplevels(self) -> T; fn calculate_miplevels(self) -> T;
/// Scale the size according to the given mipmap level.
fn scale_mipmap(self, miplevel: T) -> Size<T>; fn scale_mipmap(self, miplevel: T) -> Size<T>;
} }