diff options
author | Rosyid Haryadi <rosyid_haryadi@protonmail.com> | 2025-02-26 15:50:04 +0700 |
---|---|---|
committer | Rosyid Haryadi <rosyid_haryadi@protonmail.com> | 2025-02-26 15:50:04 +0700 |
commit | 2961d488078fd3e8297fa5c98232f1d998069fa7 (patch) | |
tree | 9f7c54a61561bcab379dc68df9e290c96a542930 /src/global.rs | |
parent | 7b0375eee4a945cc8fbb3c03cfc0657e0f1ee443 (diff) |
upd: constants
Diffstat (limited to 'src/global.rs')
-rw-r--r-- | src/global.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/global.rs b/src/global.rs index 3a1e329..932daa2 100644 --- a/src/global.rs +++ b/src/global.rs @@ -1,5 +1,17 @@ -pub const IMG_WIDTH: usize = 256; -pub const IMG_HEIGHT: usize = 256; +use crate::calculus::calculus::Point3; + + + +// "Ideal" aspect ratio, allowing fraction +pub const ASPECT_RATIO: f32 = 9.0f32 / 5.0f32; +pub const IMG_WIDTH: usize = 400; +const IMG_HEIGHT_TMP: usize = (IMG_WIDTH as f32 / ASPECT_RATIO) as usize; +pub const IMG_HEIGHT: usize = if (IMG_HEIGHT_TMP < 1) { 1 } else { IMG_HEIGHT_TMP }; + +pub const VIEWPORT_HEIGHT: usize = 2; +pub const VIEWPORT_WIDTH: usize = VIEWPORT_HEIGHT * (IMG_WIDTH / IMG_HEIGHT); +pub const FOCAL_LENGTH: f32 = 2.0; +pub const CAMERA_CENTER: Point3 = Point3 { x: 0f32, y: 0f32, z: 0f32 }; #[derive(Debug, Copy, Clone)] pub struct Pixel { |