Add more data

This commit is contained in:
hodasemi 2019-04-29 14:27:23 +02:00
parent f6b11e56b8
commit 62e00f87fa
2 changed files with 8 additions and 4 deletions

View file

@ -7,10 +7,12 @@ use crate::intersection::Intersection;
use crate::ray::Ray;
use crate::triangle::Triangle;
const AABB_BUFFER_SIZE: usize = 16384;
pub struct AccelerationData<'a> {
recursive: bool,
triangles: &'a [Triangle],
data: [AABB; 1024],
data: [AABB; AABB_BUFFER_SIZE],
}
impl<'a> AccelerationData<'a> {
@ -18,7 +20,7 @@ impl<'a> AccelerationData<'a> {
// we are creating the tree from the bottom up
// create our slice
let mut data = [AABB::new(); 1024];
let mut data = [AABB::new(); AABB_BUFFER_SIZE];
// first lets create the leaf nodes
let leaf_nodes = Self::create_leaf_nodes(input_data, triangles_per_as);

View file

@ -47,10 +47,12 @@ fn generate_grid(width: u32, height: u32) -> Vec<Triangle> {
}
fn main() {
let input_data = generate_grid(5, 5);
let input_data = generate_grid(100, 100);
let distance = 40.0;
let camera = Camera::new(
vec3(0.0, -4.0, 4.0),
vec3(-distance, -distance, distance),
vec3(0.0, 0.0, 0.0),
vec3(0.0, 0.0, 1.0),
45.0,