rtcSetSce...rFunction(3)

πŸ’– NAME πŸ’–

rtcSetSceneProgressMonitorFunction β€” bestie, this one registers a callback so you can stalk your build progress like it's your crush's story views πŸ‘€


✨ SYNOPSIS ✨

#include <embree4/rtcore.h>

typedef bool (*RTCProgressMonitorFunction)(
  void* ptr,
  double n
);

void rtcSetSceneProgressMonitorFunction(
  RTCScene scene,
  RTCProgressMonitorFunction progress,
  void* userPtr
);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so Embree has this whole progress monitor callback situation going on, and it's genuinely so useful. it lets you get pinged about how far along your hierarchy build operations are, and it also lets you straight up cancel a build mid-flight. main character energy tbh πŸ‘‘

So rtcSetSceneProgressMonitorFunction is the function that registers a progress monitor callback (that's the progress argument) along with a payload for it (the userPtr argument), and you attach it to whichever scene you want (the scene argument). slay.

Here's the tea tho: only ONE callback function per scene. that's it. one. so if you call this again, the new invocation just overwrites the callback you set before β€” no stacking, no layering, no collecting them like pokΓ©mon. and if you pass NULL as the function pointer? that disables the registered callback entirely. bye bestie πŸ‘‹

Once it's registered, Embree will hit up your callback function multiple times while it's doing hierarchy build operations on the scene. Every time it calls, it passes:

  • the payload you set at registration time (the userPtr argument), and
  • a double sitting in the range [0, 1] that estimates how far along the operation is (the n argument).
⚠️ heads up: that callback function might get called from multiple threads concurrently. yes fr fr. plan accordingly, no cap.

Now for the return value, because this is where it gets spicy 🌢️:

  • when you return true from the callback, Embree keeps the build operation going like normal, no drama πŸ’…
  • when you return false, Embree cancels the build operation and throws the RTC_ERROR_CANCELLED error code at you 😭

and good news β€” issuing multiple cancel requests for the same build operation is totally allowed. spam that cancel button if it feels right, bestie.


πŸ’€ EXIT STATUS πŸ’€

if something goes wrong, an error code gets set, and you can go query it with rtcGetDeviceError. it's giving "check your messages" energy πŸ“±


🌸 SEE ALSO 🌸

  • [rtcNewScene]

and that's the whole vibe!! this page came straight out of the Embree Ray Tracing Kernels 4 manual, and yeah β€” rtcSetSce...rFunction(3) is the abbreviated little title it rocks up with. go forth and monitor your progress, queen πŸŽ€βœ¨πŸ«Ά

πŸ“¦ where this page comes from