Skip to main content

RtGeomEntry

Struct RtGeomEntry 

Source
#[repr(C)]
pub struct RtGeomEntry { pub index_offset: u32, pub base_vertex: u32, pub albedo_index: u32, pub normal_index: u32, pub tint: [f32; 3], pub roughness: f32, pub metallic: f32, pub emissive: [f32; 3], pub model: [[f32; 4]; 4], pub emissive_map_index: u32, pub _pad: [u32; 3], }
Expand description

One entry of the ray-tracing geometry table, indexed by the intersector’s instance_id (the instance’s position in the TLAS instance buffer, one entry per instance, in instance order). Lets the RT kernel find the hit triangle’s indices in the shared index buffer, transform its local-space vertices into world space for the geometric normal, and pick a base albedo to shade the hit with. #[repr(C)], 128 bytes: the layout must stay in sync with the RtGeomEntry struct in the shared RT records (rt_types.slang), where tint and emissive are packed_float3 so the field offsets match; a plain float3 there would stride the buffer differently and fault the trace. The _pad tail rounds the struct to 128 bytes so its array stride is a multiple of the 16-byte GPU alignment of the float4x4 model (MSL/HLSL/GLSL round a matrix-bearing struct up to a 16-byte multiple, so a 116-byte Rust struct would stride 116 while the shader strides 128 and faults the trace). The size_eq / offsets unit tests below lock the Rust side. The model matrix is stored here (rather than read from the intersector’s instance transform) so the kernel’s normal math is self-contained.

Fields§

§index_offset: u32

Element offset of this object’s first index in the shared index buffer (DrawObject::index_offset).

§base_vertex: u32

Value added to each fetched index before the vertex lookup (DrawObject::base_vertex).

§albedo_index: u32

Index into the bindless albedo texture pool (DrawObject::texture_slot, clamped to the albedo count). The textured RT-hit shader samples tex_pool[albedo_index] at the hit UV; the flat fallback ignores it.

§normal_index: u32

Index into the bindless texture pool for this object’s normal map (albedo_count + normal_map_slot). The textured RT-hit shader samples tex_pool[normal_index] to perturb the hit normal via the interpolated tangent frame; objects with no normal map resolve to the 1x1 flat-normal fallback at normal slot 0, so the sample is always safe (no perturbation).

§tint: [f32; 3]

Base albedo for hit shading (the material tint), [r, g, b]. The textured shader multiplies the sampled albedo by this; the flat fallback uses it directly.

§roughness: f32

Surface roughness, used to pick the IBL prefilter mip at the hit.

§metallic: f32

Metallic factor [0, 1] for the hit PBR response: metals drop the diffuse term and tint the reflected environment specular by their albedo.

§emissive: [f32; 3]

Self-emission added to the hit colour, so glowing surfaces light up in reflections regardless of incident lighting. Fills the three words that pad metallic out to a 16-byte boundary (the MSL side reads it as a packed_float3 at the same offset; the layout test pins the exact size).

§model: [[f32; 4]; 4]

Column-major object-to-world transform (DrawObject::model), used to lift the hit triangle’s local-space vertices into world space.

§emissive_map_index: u32

Bindless albedo-pool index for the emissive map (0 = none). The textured RT-hit shader multiplies the self-emission by this map sample, so glowing textured surfaces (e.g. the bistro string lights) reflect in colour rather than the scalar emissive; the flat fallback ignores it. Mirrors MaterialUniforms::emissive_map_index / GpuObjectData::emissive_map_index.

§_pad: [u32; 3]

Pads the struct to 128 bytes (a multiple of the 16-byte GPU alignment of the float4x4 model) so the Rust array stride matches the shader stride.

Trait Implementations§

Source§

impl Clone for RtGeomEntry

Source§

fn clone(&self) -> RtGeomEntry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RtGeomEntry

Source§

impl Debug for RtGeomEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RtGeomEntry

Source§

fn eq(&self, other: &RtGeomEntry) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RtGeomEntry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more