fixed cylinders, added another lua scene

This commit is contained in:
Codinget
2021-04-29 19:38:49 +02:00
parent f2c4983645
commit 9529f56a01
5 changed files with 134 additions and 5 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ fn default_scene3() -> Scene {
fn main() {
// get scene and camera
let scene = scene_from_file("scenes/randomspheres.lua".to_owned()).unwrap();
let scene = scene_from_file("scenes/smolgalaxy.lua".to_owned()).unwrap();
let cam = default_cam();
// get stats on the scene we're about to render
+2 -2
View File
@@ -15,9 +15,9 @@ impl Cylinder {
impl Obj for Cylinder {
fn distance_to(&self, point: Vec3) -> f64 {
Vec3::new(self.center.x(), 0., self.center.z()).distance_to(point) - self.radius
Vec3::new(self.center.x(), point.y(), self.center.z()).distance_to(point) - self.radius
}
fn normal_at(&self, point: Vec3) -> Vec3 {
point - Vec3::new(self.center.x(), 0.,self.center.z())
point - Vec3::new(self.center.x(), point.y(),self.center.z())
}
}