1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use crate::{
err::Error,
file::Build,
geom::{Camera, Orient},
math::Pos3,
};
use arctk_attr::load;
use std::path::Path;
#[load]
pub struct CameraBuilder {
pos: Pos3,
tar: Pos3,
fov: f64,
res: [usize; 2],
ss_power: Option<usize>,
}
impl Build for CameraBuilder {
type Inst = Camera;
#[inline]
fn build(self, _in_dir: &Path) -> Result<Self::Inst, Error> {
let ss = self.ss_power.map_or(1, |ss| ss);
Ok(Self::Inst::new(
Orient::new_tar(self.pos, &self.tar),
self.fov.to_radians(),
self.res,
ss,
))
}
}