aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 3bf9bb2801c80f6da4482a01380df8b8a028f45c (plain)
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
mod vector;
mod camera;
mod canvas;
use std::f32::consts::PI;

use crate::{camera::{Buffer, Camera}, vector::Vector};

trait Object {
    fn sdf(&self, point: Vector) -> f32;
}

fn main() {
    let mut cam = Camera {
        position: Vector { x: 0.0, y: 0.0, z: 0.0 },
        direction: Vector { x: 1.0, y: 0.0, z: 0.0 },
        angle: PI / 2.0,
        distance: 1.0,
        aspect_ratio: 1.0,
        brightness: 10.0,
        buffer: Buffer([['.'; 60]; 30])
    };

    for _i in 0..60 {
        cam.render();
        println!("{}", cam.buffer);
    }
}