clean up dead code

This commit is contained in:
CDaut 2023-11-28 09:25:27 +01:00
parent 44514117cd
commit e1c61ef944
3 changed files with 1 additions and 27 deletions

View file

@ -4,30 +4,6 @@ use image::{DynamicImage, GenericImage, Rgba};
const GAMMA: f32 = 2.0;
/// normalizes the color for k rays on a single pixel
pub fn normalize_color_single_pixel(radiosity_vector: Vector4<f32>) -> Rgba<u8> {
let radiosity_as_arr = [
radiosity_vector.x,
radiosity_vector.y,
radiosity_vector.z,
];
//linearly map luminosity values to [0..255]
let range: f32 =
radiosity_as_arr.iter().fold(f32::NEG_INFINITY, |a, b| a.max(*b)) -
radiosity_as_arr.iter().fold(f32::INFINITY, |a, b| a.min(*b));
let color_value: Vector4<u8> =
radiosity_vector.map(|lum_val|
f32::ceil((lum_val / range) * 255.0) as u8
);
//just make the pixel opaque
//TODO: consider alpha
Rgba([color_value.x, color_value.y, color_value.z, 255])
}
pub fn normalize_colors_global(radiosity_buffer: &mut Vec<Vec<Vector4<f32>>>) -> &Vec<Vec<Vector4<f32>>> {
//largest radiosity found yet
let mut maximum_radiosity = f32::NEG_INFINITY;

View file

@ -65,6 +65,6 @@ fn main() {
let output_image =
store_colors_to_image(as_colors);
output_image.save("../output_image.png").expect("Unable to save image!");
output_image.save("/home/clemens/repositorys/raytrace-rs/output_image.png").expect("Unable to save image!");
}

View file

@ -1,9 +1,7 @@
use indicatif::ProgressIterator;
use std::f32::consts::PI;
use std::ops::{Add, Mul};
use std::sync::{Arc, Mutex};
use cgmath::{Angle, ElementWise, InnerSpace, Matrix4, Vector2, Vector3, Vector4};
use cgmath::num_traits::abs;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use easy_gltf::model::{Mode};
use easy_gltf::{Camera, Projection, Scene};