#[repr(C)]pub struct RtCompressedTriangle {
pub v0: [f32; 3],
pub e1_e2: [u16; 6],
}Expand description
A compressed 3D triangle optimized for GPU ray intersection performance.
Fields§
§v0: [f32; 3]Base vertex
e1_e2: [u16; 6]Edges 1 & 2 encoded as IEEE 754 f16 v1 - v0, v2 - v0
Implementations§
Source§impl RtCompressedTriangle
impl RtCompressedTriangle
pub fn new(v0: Vec3A, v1: Vec3A, v2: Vec3A) -> Self
pub fn vertices(&self) -> [Vec3A; 3]
pub fn aabb(&self) -> Aabb
pub fn compute_normal(&self) -> Vec3A
Sourcepub fn intersect(&self, ray: &Ray) -> f32
pub fn intersect(&self, ray: &Ray) -> f32
Find the distance (t) of the intersection of the Ray and this Triangle.
Returns f32::INFINITY for miss.
pub fn unpack(&self) -> (Vec3A, Vec3A, Vec3A)
pub fn compute_barycentric(&self, ray: &Ray) -> Vec2
Trait Implementations§
Source§impl Clone for RtCompressedTriangle
impl Clone for RtCompressedTriangle
Source§fn clone(&self) -> RtCompressedTriangle
fn clone(&self) -> RtCompressedTriangle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for RtCompressedTriangle
impl Default for RtCompressedTriangle
Source§fn default() -> RtCompressedTriangle
fn default() -> RtCompressedTriangle
Returns the “default value” for a type. Read more
Source§impl From<&Triangle> for RtCompressedTriangle
impl From<&Triangle> for RtCompressedTriangle
Source§impl PartialEq for RtCompressedTriangle
impl PartialEq for RtCompressedTriangle
impl Copy for RtCompressedTriangle
impl Pod for RtCompressedTriangle
impl StructuralPartialEq for RtCompressedTriangle
Auto Trait Implementations§
impl Freeze for RtCompressedTriangle
impl RefUnwindSafe for RtCompressedTriangle
impl Send for RtCompressedTriangle
impl Sync for RtCompressedTriangle
impl Unpin for RtCompressedTriangle
impl UnwindSafe for RtCompressedTriangle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.