rtcSetGeo...sFunction(3)

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

πŸ’– rtcSetGeometryBoundsFunction πŸ’–

okay bestie, welcome to the Embree Ray Tracing Kernels 3 manual page for rtcSetGeometryBoundsFunction (that's the rtcSetGeo...sFunction(3) one, iykyk ✨). grab a boba, sit down, we're learning about bounds callbacks 🧚


✨ NAME ✨

rtcSetGeometryBoundsFunction β€” sets a callback to query the bounding box of user-defined primitives 🫢


🌸 SYNOPSIS 🌸

#include <embree3/rtcore.h>

struct RTCBoundsFunctionArguments
{
  void* geometryUserPtr;
  unsigned int primID;
  unsigned int timeStep;
  struct RTCBounds* bounds_o;
};

typedef void (*RTCBoundsFunction)(
  const struct RTCBoundsFunctionArguments* args
);

void rtcSetGeometryBoundsFunction(
  RTCGeometry geometry,
  RTCBoundsFunction bounds,
  void* userPtr
);

πŸ¦‹ DESCRIPTION πŸ¦‹

so rtcSetGeometryBoundsFunction registers a bounding box callback function (that's the bounds argument) with payload (that's the userPtr argument) for the specified user geometry (the geometry argument). it's giving matchmaking, but for callbacks πŸ’…

only a single callback function can be registered per geometry, bestie. and further invocations overwrite the previously set callback function β€” no stacking, no polygamy, one callback at a time πŸ™ˆ

passing NULL as function pointer disables the registered callback function. poof, gone, nothing left πŸ’€

the registered bounding box callback function gets invoked to calculate axis-aligned bounding boxes of the primitives of the user-defined geometry during spatial acceleration structure construction. very main character energy honestly. the bounding box callback β€” which is of type RTCBoundsFunction β€” is invoked with a pointer to a structure of type RTCBoundsFunctionArguments, and that struct contains various arguments, such as:

  • the user data of the geometry (the geometryUserPtr member) πŸŽ€
  • the ID of the primitive to calculate the bounds for (the primID member) πŸ”₯
  • the time step at which to calculate the bounds (the timeStep member) ⭐
  • and a memory location to write the calculated bound to (the bounds_o member) πŸ‘‘

in a typical usage scenario one would store a pointer to the internal representation of the user geometry object using rtcSetGeometryUserData. then the callback function can read that pointer from the geometryUserPtr field, calculate the proper bounding box for the requested primitive and time, and store that bounding box to the destination structure (the bounds_o member). it's literally a lil relay race of pointers and we're obsessed 🌈


😭 EXIT STATUS 😭

on failure an error code is set that can be queried using rtcGetDeviceError. not the vibe, but at least you can check πŸ“


πŸ’œ SEE ALSO πŸ’œ

  • [RTC_GEOMETRY_TYPE_USER]

<div style="text-align:right">okay that's the whole page bestie!! this was rtcSetGeometryBoundsFunction from Embree Ray Tracing Kernels 3 (yes, the rtcSetGeo...sFunction(3) one) πŸ’– go forth and calculate ur bounds, no cap βœ¨πŸŽ€πŸ¦‹</div>

πŸ“¦ where this page comes from