rtcSetGeo...sFunction(3)
π rtcSetGeo...sFunction(3) β Embree Ray Tracing Kernels 4
okay bestie, gather round, because this one is literally the glow-up your custom geometry has been waiting for β¨ it lives in the Embree Ray Tracing Kernels 4 manual, it's page rtcSetGeo...sFunction(3), and it's all about telling Embree how to hug your weird little user-defined primitives with bounding boxes. no cap.
π NAME π
rtcSetGeometryBoundsFunction β sets a callback so Embree can ask you what the bounding box of your user-defined primitives is π
β¨ SYNOPSIS β¨
#include <embree4/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, bestie) together with a payload (the userPtr argument) onto the user geometry you picked (the geometry argument). it's giving "hey Embree, here's my phone number, text me when you need a bbox" π±π
Only a single callback function can be registered per geometry β one (1) β and further invocations overwrite the previously set callback function. yes, it's a "new phone who dis" situation, the old one is gone. and if you pass NULL as the function pointer? that disables the registered callback function entirely. bye bye π
In SYCL mode the BVH construction is done on the host, and the function pointer you pass must be a host-side function pointer. periodt. don't try to be cute with it.
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 ποΈβ¨ The bounding box callback of RTCBoundsFunction type is invoked with a pointer to a structure of type RTCBoundsFunctionArguments which contains various arguments, such as:
- the user data of the geometry β that's the
geometryUserPtrmember π«Ά - the ID of the primitive to calculate the bounds for β the
primIDmember π’ - the time step at which to calculate the bounds β the
timeStepmember β±οΈ - and a memory location to write the calculated bound to β the
bounds_omember π
In a typical usage scenario, one would store a pointer to the internal representation of the user geometry object using rtcSetGeometryUserData. The callback function can then read that pointer from the geometryUserPtr field and 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 a whole little loop of trust, iykyk π
π EXIT STATUS π
On failure an error code is set that can be queried using rtcGetDeviceError. so if something goes sideways, that's where the receipts live π§Ύ
π SEE ALSO π
[RTC_GEOMETRY_TYPE_USER]
okay that's the whole page, mwah π it's from the Embree Ray Tracing Kernels 4 manual, and yes the page is still called rtcSetGeo...sFunction(3) β truncated name, full drama, we love her for it πβ¨
π¦ where this page comes from
- ubuntu stonking: libembree-dev 4.4.1+dfsg-2ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms