diff options
author | eug-vs <eugene@eug-vs.xyz> | 2021-10-27 12:09:49 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2021-10-27 12:09:49 +0300 |
commit | f704384b9938215f818c1c2006ad9b233c0d7c00 (patch) | |
tree | a6dae17c016229a1b4902584db2da7c725fdb9b8 | |
parent | a63a5fd647a2117885e70954181ea7164e470bb3 (diff) | |
download | pistol-f704384b9938215f818c1c2006ad9b233c0d7c00.tar.gz |
feat: increase screen size
-rw-r--r-- | src/camera.rs | 9 | ||||
-rw-r--r-- | src/main.rs | 5 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/camera.rs b/src/camera.rs index d87abe2..30d338e 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -12,16 +12,16 @@ pub fn rotate_z(vec: Vector, angle: f32) -> Vector { } } -const WIDTH: i32 = 120; +const WIDTH: i32 = 180; const HEIGHT: i32 = 60; #[derive(Debug)] -pub struct Buffer (pub [[char; 120]; 60]); +pub struct Buffer (pub [[char; 180]; 60]); impl fmt::Display for Buffer { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for i in 0..60 { - for j in 0..120 { + for j in 0..180 { write!(f, "{}", self.0[i][j])?; } writeln!(f)?; @@ -80,7 +80,8 @@ impl Camera { } pub fn rorate_around_point(& mut self, point: Vector) { - self.position = rotate_z(self.position - point, 2.0 * PI / 60.0) + point; + let rotations_per_round = 2.0; + self.position = rotate_z(self.position - point, rotations_per_round * 2.0 * PI / 60.0) + point; self.direction = (point - self.position).normalize(); } diff --git a/src/main.rs b/src/main.rs index d5c8278..ae1fafb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,15 +11,14 @@ fn main() { direction: Vector3 { x: 1.0, y: 0.0, z: 0.0 }, angle: PI / 2.0, distance: 1.0, - aspect_ratio: 1.0, + aspect_ratio: 2.0 / 3.0, brightness: 5.0, - buffer: Buffer([['.'; 120]; 60]), + buffer: Buffer([['.'; 180]; 60]), time: 0.0, }; for _round in 0..20 { for i in 0..60 { - // 1 sin round cam.time = (i as f32 / 60.0) * 2.0 * PI; cam.render(); println!("{}", cam.buffer); |