commit for stack exchange

This commit is contained in:
CDaut 2023-11-22 23:28:21 +01:00
parent 8657806aba
commit 053a69e5b7
7 changed files with 25 additions and 34 deletions

View file

@ -31,6 +31,8 @@ pub fn construct_primary_rays(camera: &Camera,
panic!("Non invertible transform Matrix. giving up.")
);
dbg!(camera.transform);
//TODO: take ray multiplier per pixel into account here
let mut rays: Vec<Ray> = Vec::with_capacity(height * width);
@ -59,7 +61,7 @@ fn generate_single_primary_ray(image_width: usize,
let direction_view_space: Vector4<f32> =
Vector4::new(u as f32 - (image_width as f32 / 2.0),
v as f32 - (image_height as f32 / 2.0),
-focal_length,
focal_length,
0.0);
//TODO: Rotation is fucked
//x rotation has sign wrong, y and z are flipped

View file

@ -75,6 +75,7 @@ fn raytrace(ray: &Ray, scene: &Scene) -> Rgba<u8> {
// a new closer Point is found
if t < smallest_t {
smallest_t = t;
//TODO: lighting model is not at all considered. Just a debug hack.
clostest_intersection_point = Option::from(isec);
let color_vec = model.material().get_base_color_alpha(
Vector2::new(0.0, 0.0)