-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2a4c96
commit fe6d1c7
Showing
3 changed files
with
45 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#[repr(C)] | ||
#[derive(Clone, Copy, Debug, Default, PartialEq, bytemuck::Pod, bytemuck::Zeroable)] | ||
pub struct Intersection { | ||
t: f32, | ||
u: f32, | ||
v: f32, | ||
prim: u32, | ||
} | ||
|
||
#[repr(C, align(16))] | ||
#[derive(Clone, Copy, Debug, Default, PartialEq, bytemuck::Pod, bytemuck::Zeroable)] | ||
pub struct Ray { | ||
pub origin: [f32; 3], | ||
pub padding_0: u32, | ||
pub dir: [f32; 3], | ||
pub padding_1: u32, | ||
pub r_d: [f32; 3], | ||
pub padding_2: u32, | ||
pub hit: Intersection, | ||
} | ||
|
||
impl Ray { | ||
pub fn new(origin: [f32; 3], dir: [f32; 3]) -> Self { | ||
Self { | ||
origin, | ||
dir, | ||
..Default::default() | ||
} | ||
} | ||
} |