rtcInitPo...ryContext(3)

πŸ’– NAME πŸ’–

rtcInitPointQueryContext β€” bestie, this is the one that sets up your context info (like, the stack of (multilevel-)instance transformations) for point queries ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <embree4/rtcore.h>

struct RTC_ALIGN(16) RTCPointQueryContext
{
  // accumulated 4x4 column major matrices from world to instance space.
  float world2inst[RTC_MAX_INSTANCE_LEVEL_COUNT][16];

  // accumulated 4x4 column major matrices from instance to world space.
  float inst2world[RTC_MAX_INSTANCE_LEVEL_COUNT][16];

  // instance ids.
  unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT];

  // number of instances currently on the stack.
  unsigned int instStackSize;
};

void rtcInitPointQueryContext(
  struct RTCPointQueryContext* context
);

🌸 DESCRIPTION 🌸

Okay so picture a stack β€” and it's literally the RTCPointQueryContext type β€” that holds onto the IDs and the instance transformations while a BVH traversal is happening for a point query. The way that these transformations are assumed to be affine transformations (that's a 3Γ—3 matrix plus a translation, iykyk) means the last column just gets ignored, no cap. (peep [RTC_GEOMETRY_TYPE_INSTANCE] if you want the deets πŸ‘€)

The rtcInitPointContext function initializes the context to its default values, and bestie, you should be calling it for initialization. That's the vibe check. πŸ’…

So the context gets passed as an argument to the point query callback function (see [rtcSetGeometryPointQueryFunction]) and you're gonna use it to pass instance information down the instancing chain for user defined instancing β€” the tutorial [ClosestPoint] has a reference implementation of point queries with user defined instancing if you want to see it done right 🫢

And lowkey important: the context is a necessary argument to [rtcPointQuery]. Embree internally grabs the topmost instance transformation off the stack to transform the point query into instance space. Main character transformation behavior fr fr ✨


πŸ’€ EXIT STATUS πŸ’€

No error code is set by this function. Zero drama, zero errors, iconic behavior. πŸ‘‘


🌈 SEE ALSO 🌈

  • [rtcPointQuery]
  • [rtcSetGeometryPointQueryFunction]

okay that's the whole page bestie, go forth and init your context πŸ’œ This was rtcInitPo...ryContext(3) from Embree Ray Tracing Kernels 4 β€” mwah, stan, bye πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from