#[derive(Debug, Clone, Copy)]
pub struct OpticastSettings {
pub xres: u32,
pub yres: u32,
pub y_start: u32,
pub y_end: u32,
pub hx: f32,
pub hy: f32,
pub hz: f32,
pub anginc: f32,
pub mip_levels: u32,
pub mip_scan_dist: i32,
pub max_scan_dist: i32,
}
impl OpticastSettings {
#[allow(clippy::cast_precision_loss)]
#[must_use]
pub fn for_oracle_framebuffer(width: u32, height: u32) -> Self {
let half_w = (width as f32) * 0.5;
let half_h = (height as f32) * 0.5;
Self {
xres: width,
yres: height,
y_start: 0,
y_end: height,
hx: half_w,
hy: half_h,
hz: half_w,
anginc: 1.0,
mip_levels: 1,
mip_scan_dist: 4,
max_scan_dist: 1024,
}
}
#[must_use]
pub fn with_y_range(mut self, y_start: u32, y_end: u32) -> Self {
self.y_start = y_start;
self.y_end = y_end;
self
}
}