RTCRayN(3)

πŸ’– RTCRayN β€” ray packet of runtime size πŸ’–

okay so bestie, welcome to RTCRayN, straight outta the Embree Ray Tracing Kernels 4 manual, section 3. this is the ✨runtime-sized ray packet✨ of your dreams. let's get into it πŸ¦‹


🌸 NAME 🌸

RTCRayN β€” a ray packet whose size is, like, runtime. she doesn't know how many rays she's carrying until the moment arrives. main character energy fr πŸ’…


✨ SYNOPSIS ✨

#include <embree4/rtcore_ray.h>

struct RTCRayN;

float& RTCRayN_org_x(RTCRayN* ray, unsigned int N, unsigned int i);
float& RTCRayN_org_y(RTCRayN* ray, unsigned int N, unsigned int i);
float& RTCRayN_org_z(RTCRayN* ray, unsigned int N, unsigned int i);
float& RTCRayN_tnear(RTCRayN* ray, unsigned int N, unsigned int i);

float& RTCRayN_dir_x(RTCRayN* ray, unsigned int N, unsigned int i);
float& RTCRayN_dir_y(RTCRayN* ray, unsigned int N, unsigned int i);
float& RTCRayN_dir_z(RTCRayN* ray, unsigned int N, unsigned int i);
float& RTCRayN_time (RTCRayN* ray, unsigned int N, unsigned int i);

float&        RTCRayN_tfar (RTCRayN* ray, unsigned int N, unsigned int i);
unsigned int& RTCRayN_mask (RTCRayN* ray, unsigned int N, unsigned int i);
unsigned int& RTCRayN_id   (RTCRayN* ray, unsigned int N, unsigned int i);
unsigned int& RTCRayN_flags(RTCRayN* ray, unsigned int N, unsigned int i);

like look at her. twelve little helper functions, all serving looks πŸŽ€


πŸ’« DESCRIPTION πŸ’«

so here's the tea, bestie β˜•: sometimes you don't know the ray packet size until the program is actually running. the classic example β€” when Embree hands you a ray packet inside the RTCFilterFuncN callback function β€” and at that point, compile-time knowledge said "not today." that's when Embree reaches for the RTCRayN type. it's the runtime-size packet. she's flexible. she's adaptable. she's giving versatile πŸ’β€β™€οΈ

⚠️ okay important: these ray packets can only have sizes of 1, 4, 8, or 16. no other packet size will be used. not 2, not 3, not 7, not your little weird custom number. those four and that's it. periodt πŸ’€

so you've got two ways to play this, and both are valid:

  1. implement a different special code path for each of those possible packet sizes, and cast the ray to the appropriate ray packet type 🌈
  2. implement one general code path that uses the RTCRayN_XXX helper functions to access the ray packet components πŸ‘‘

and about those helper functions β€” here's the vibe check on how they work. each one takes:

  • a pointer to the ray packet β€” that's the ray argument 🫢
  • the packet size β€” that's the N argument πŸ“
  • and it returns a reference to a component (like, say, the x-component of the origin 🌸) of the i-th ray of the packet β€” that's the i argument 🎯

so you hand her the packet, the size, and the index, and she hands you back a reference to exactly the piece you asked for. iconic. no cap πŸ’–


πŸ™ˆ EXIT STATUS πŸ™ˆ

...bestie. there is nothing here. this section is empty. it's giving silence. moving on ✨


πŸ¦‹ SEE ALSO πŸ¦‹

  • [RTCHitN] β€” go say hi, they're cousins πŸ’œ

and that's the whole page, gorgeous πŸ’… go forth and index your runtime-sized rays responsibly.

RTCRayN(3) β€” from the Embree Ray Tracing Kernels 4 manual, section 3. no date on this one bestie, she's timeless like that. mwah 😘 πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from