From 9c56134c67c5dd0ee2f6ce3f7c65cec136773290 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 23 Mar 2020 23:56:26 +0100 Subject: [PATCH] beevee: add library to workspace This is designed to be the new BVH for the raytracer. --- Cargo.toml | 1 + beevee/Cargo.toml | 10 ++++++++++ beevee/src/aabb/bounding_box.rs | 5 +++++ beevee/src/aabb/mod.rs | 4 ++++ beevee/src/bvh/mod.rs | 4 ++++ beevee/src/bvh/tree.rs | 2 ++ beevee/src/lib.rs | 25 +++++++++++++++++++++++++ beevee/src/ray.rs | 5 +++++ 8 files changed, 56 insertions(+) create mode 100644 beevee/Cargo.toml create mode 100644 beevee/src/aabb/bounding_box.rs create mode 100644 beevee/src/aabb/mod.rs create mode 100644 beevee/src/bvh/mod.rs create mode 100644 beevee/src/bvh/tree.rs create mode 100644 beevee/src/lib.rs create mode 100644 beevee/src/ray.rs diff --git a/Cargo.toml b/Cargo.toml index 6e54766..9bde527 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = [ + "beevee", "pathtracer", ] diff --git a/beevee/Cargo.toml b/beevee/Cargo.toml new file mode 100644 index 0000000..ca5babe --- /dev/null +++ b/beevee/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "beevee" +version = "0.1.0" +authors = ["Bruno BELANYI "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +nalgebra = "0.20" diff --git a/beevee/src/aabb/bounding_box.rs b/beevee/src/aabb/bounding_box.rs new file mode 100644 index 0000000..6c40f9d --- /dev/null +++ b/beevee/src/aabb/bounding_box.rs @@ -0,0 +1,5 @@ +//! An Axis-Alighned Bounding Box. + +/// An axis-aligned bounding box. +#[derive(Copy, Clone, Debug, PartialEq)] +pub struct AABB {} diff --git a/beevee/src/aabb/mod.rs b/beevee/src/aabb/mod.rs new file mode 100644 index 0000000..d469ebd --- /dev/null +++ b/beevee/src/aabb/mod.rs @@ -0,0 +1,4 @@ +//! The module relating to Axis-Aligned Bounding Boxes. + +mod bounding_box; +pub use bounding_box::*; diff --git a/beevee/src/bvh/mod.rs b/beevee/src/bvh/mod.rs new file mode 100644 index 0000000..3f85832 --- /dev/null +++ b/beevee/src/bvh/mod.rs @@ -0,0 +1,4 @@ +//! The Boudning Volume Hiearchy + +mod tree; +pub use tree::*; diff --git a/beevee/src/bvh/tree.rs b/beevee/src/bvh/tree.rs new file mode 100644 index 0000000..b11bd35 --- /dev/null +++ b/beevee/src/bvh/tree.rs @@ -0,0 +1,2 @@ +/// The BVH containing all the objects. +pub struct BVH {} diff --git a/beevee/src/lib.rs b/beevee/src/lib.rs new file mode 100644 index 0000000..bd9f6e8 --- /dev/null +++ b/beevee/src/lib.rs @@ -0,0 +1,25 @@ +#![warn(missing_docs)] + +//! A Bounding Volume Hierarchy crate for use with ray-tracing. + +/// The point to describe the [`AABB`]'s corners. +/// +/// [`AABB`]: aabb/struct.AABB.html +pub type Point = nalgebra::Point3; + +/// The Vector to describe the [`Ray`]'s direction. +/// +/// [`Ray`]: ray/struct.Ray.html +pub type Vector = nalgebra::Vector3; + +/// The module relating to Axis-Aligned Bouding Boxes. +pub mod aabb; + +/// The module relating to Bouding Volume Hiearchy +pub mod bvh; + +/// Module defining a [`Ray`] structure to intersect with the [`BVH`] +/// +/// [`BVH`]: ../bvh/struct.BVH.html +/// [`Ray`]: struct.Ray.html +pub mod ray; diff --git a/beevee/src/ray.rs b/beevee/src/ray.rs new file mode 100644 index 0000000..127aac0 --- /dev/null +++ b/beevee/src/ray.rs @@ -0,0 +1,5 @@ +/// The [`Ray`] to intersect with the [`BVH`]. +/// +/// [`BVH`]: ../bvh/struct.BVH.html +/// [`Ray`]: struct.Ray.html +pub struct Ray {}