Add more data
This commit is contained in:
parent
f6b11e56b8
commit
62e00f87fa
2 changed files with 8 additions and 4 deletions
|
@ -7,10 +7,12 @@ use crate::intersection::Intersection;
|
||||||
use crate::ray::Ray;
|
use crate::ray::Ray;
|
||||||
use crate::triangle::Triangle;
|
use crate::triangle::Triangle;
|
||||||
|
|
||||||
|
const AABB_BUFFER_SIZE: usize = 16384;
|
||||||
|
|
||||||
pub struct AccelerationData<'a> {
|
pub struct AccelerationData<'a> {
|
||||||
recursive: bool,
|
recursive: bool,
|
||||||
triangles: &'a [Triangle],
|
triangles: &'a [Triangle],
|
||||||
data: [AABB; 1024],
|
data: [AABB; AABB_BUFFER_SIZE],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> AccelerationData<'a> {
|
impl<'a> AccelerationData<'a> {
|
||||||
|
@ -18,7 +20,7 @@ impl<'a> AccelerationData<'a> {
|
||||||
// we are creating the tree from the bottom up
|
// we are creating the tree from the bottom up
|
||||||
|
|
||||||
// create our slice
|
// create our slice
|
||||||
let mut data = [AABB::new(); 1024];
|
let mut data = [AABB::new(); AABB_BUFFER_SIZE];
|
||||||
|
|
||||||
// first lets create the leaf nodes
|
// first lets create the leaf nodes
|
||||||
let leaf_nodes = Self::create_leaf_nodes(input_data, triangles_per_as);
|
let leaf_nodes = Self::create_leaf_nodes(input_data, triangles_per_as);
|
||||||
|
|
|
@ -47,10 +47,12 @@ fn generate_grid(width: u32, height: u32) -> Vec<Triangle> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let input_data = generate_grid(5, 5);
|
let input_data = generate_grid(100, 100);
|
||||||
|
|
||||||
|
let distance = 40.0;
|
||||||
|
|
||||||
let camera = Camera::new(
|
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, 0.0),
|
||||||
vec3(0.0, 0.0, 1.0),
|
vec3(0.0, 0.0, 1.0),
|
||||||
45.0,
|
45.0,
|
||||||
|
|
Loading…
Reference in a new issue