aboutsummaryrefslogtreecommitdiff
path: root/src/camera/filter
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-01-25 14:43:46 +0100
committerJulian T <julian@jtle.dk>2021-01-25 14:43:46 +0100
commit33a35c50c20e863123642c8c9ea31dfc006945f6 (patch)
tree6bbdd9f0f5d4deddec50fca1c3dbff3f2878ffac /src/camera/filter
parent41ea2d8f94043d49fc26aaaa8030a73dcfdc2da9 (diff)
Started work on implementing vectors bounding and film
Diffstat (limited to 'src/camera/filter')
-rw-r--r--src/camera/filter/mod.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/camera/filter/mod.rs b/src/camera/filter/mod.rs
new file mode 100644
index 0000000..93c6fc5
--- /dev/null
+++ b/src/camera/filter/mod.rs
@@ -0,0 +1,22 @@
+use crate::vector::Vector2f;
+use crate::Float;
+
+pub trait Filter {
+ fn eval(&self, point: &Vector2f) -> Float;
+ fn radius(&self) -> Vector2f;
+}
+
+pub struct BoxFilter {
+ radius: Vector2f,
+}
+
+// The same a no filter, and can give aliasing in final image
+impl Filter for BoxFilter {
+ fn eval(&self, _: &Vector2f) -> Float {
+ 1.0
+ }
+
+ fn radius(&self) -> Vector2f {
+ self.radius
+ }
+}