mod look;
pub use look::{
AgxLook, AutoExposure, BloomParameters, ColorGrading, ColorGradingGlobal, ColorGradingSection,
CompensationCurve, CompensationCurveError, Exposure, MeteringMask, MotionBlurParameters,
};
use crate::content::identity::EnvironmentId;
use crate::content::lighting::{
Backdrop, DirectionalLight, EnvironmentLight, HemisphereLight, Mist,
};
use glam::camera;
use glam::{Mat4, Vec3};
pub fn perspective(fov_y_radians: f32, aspect: f32, near: f32) -> Mat4 {
camera::rh::proj::directx::perspective_infinite_reverse(fov_y_radians, aspect, near)
}
#[derive(Clone, Copy, Debug)]
pub struct Camera {
pub view: Mat4,
pub projection: Mat4,
pub eye: Vec3,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Fog {
pub density: f32,
pub albedo: [f32; 3],
pub anisotropy: f32,
pub ambient: f32,
pub height: f32,
pub height_falloff: f32,
pub length: f32,
pub sky_affect: f32,
}
impl Default for Fog {
fn default() -> Self {
Self {
density: 0.,
albedo: [1.; 3],
anisotropy: 0.2,
ambient: 0.,
height: 0.,
height_falloff: 0.,
length: 64.,
sky_affect: 1.,
}
}
}
#[derive(Clone, Copy)]
pub struct FrameInput {
pub camera: Camera,
pub camera_cut: bool,
pub elapsed_seconds: f64,
pub frame_time_ms: f32,
pub visibility_mask: u32,
pub environment: Option<EnvironmentId>,
pub directional_lights: [Option<DirectionalLight>; 2],
pub hemisphere_light: HemisphereLight,
pub diffuse_environment: EnvironmentLight,
pub backdrop: Backdrop,
pub baked_lighting: bool,
pub atmosphere: bool,
pub fog: Fog,
pub mist: Mist,
pub reflection_environment: EnvironmentLight,
pub exposure: Exposure,
pub bloom: BloomParameters,
pub motion_blur: MotionBlurParameters,
pub color_grading: ColorGrading,
pub ambient_occlusion_radius: f32,
}
impl FrameInput {
pub fn new(camera: Camera) -> Self {
Self {
camera,
camera_cut: false,
elapsed_seconds: 0.,
frame_time_ms: 1000. / 60.,
visibility_mask: 0,
environment: None,
directional_lights: [None; 2],
hemisphere_light: HemisphereLight::default(),
diffuse_environment: EnvironmentLight::default(),
backdrop: Backdrop::Environment {
yaw: 0.,
brightness: 1.,
},
baked_lighting: true,
atmosphere: false,
fog: Fog::default(),
mist: Mist::default(),
reflection_environment: EnvironmentLight::default(),
exposure: Exposure::default(),
bloom: BloomParameters::default(),
motion_blur: MotionBlurParameters::default(),
color_grading: ColorGrading::default(),
ambient_occlusion_radius: 0.5,
}
}
}