RTCHitN(3)

πŸ“¦ version 3.13.5, in epel 9, fedora 43, fedora 44

✨ RTCHitN ✨

okay bestie, gather round, because today we're talking about RTCHitN β€” the hit packet of runtime size πŸ’– no cap, that's literally the whole vibe.


🌸 SYNOPSIS 🌸

#include <embree3/rtcore.h>

struct HitN;

float& RTCHitN_Ng_x(RTCHitN* hit, unsigned int N, unsigned int i);
float& RTCHitN_Ng_y(RTCHitN* hit, unsigned int N, unsigned int i);
float& RTCHitN_Ng_z(RTCHitN* hit, unsigned int N, unsigned int i);

float& RTCHitN_u(RTCHitN* hit, unsigned int N, unsigned int i);
float& RTCHitN_v(RTCHitN* hit, unsigned int N, unsigned int i);

unsigned& RTCHitN_primID(RTCHitN* hit, unsigned int N, unsigned int i);
unsigned& RTCHitN_geomID(RTCHitN* hit, unsigned int N, unsigned int i);
unsigned& RTCHitN_instID(RTCHitN* hit, unsigned int N, unsigned int i, unsigned int level);

like, the whole cast is right there 🫢 go off.


πŸ’… DESCRIPTION πŸ’…

so here's the tea πŸ“ β€” sometimes the hit packet size just isn't known at compile time. like, it's giving mystery. that happens when Embree hands you a hit packet inside the RTCFilterFuncN callback function. in those moments, Embree uses the RTCHitN type for hit packets, and that's just how it is, periodt.

and here's the important bit, bestie, don't skip this: these hit packets can only have sizes of 1, 4, 8, or 16. no other packet size will be used. that's it. that's the list. πŸ”₯

so you've got two whole options, pick your main character energy:

  1. implement different special code paths for each of those possible packet sizes, and cast the hit to the appropriate hit packet type β€” very ✨ bespoke ✨ of you
  2. implement one general code path that uses the RTCHitN_XXX helper functions to access hit packet components β€” lowkey the chill option, highkey efficient πŸ¦‹

now, how do these helper functions work? they take:

  • a pointer to the hit packet β€” that's the hit argument πŸ‘‘
  • the packet size β€” that's the N argument πŸ’«

…and they return a reference to a component (like the x component of Ng) of the the i-th hit of the packet β€” and i is, you guessed it, the i argument 🌈

so like. pointer in, size in, reference out. it's giving functional. it's giving elegant. iykyk πŸ’œ


😭 EXIT STATUS 😭

(nothing here bestie, it's empty, we move on πŸ’€)


πŸŽ€ SEE ALSO πŸŽ€

  • [RTCRayN]

that's the whole page, babe β€” icon status achieved πŸ’…βœ¨

signing off with love from the Embree Ray Tracing Kernels 3 era, page RTCHitN(3), dated right there in the footer like a lil timestamp on the group chat 🫢

πŸ“¦ where this page comes from