rtcSetSce...rFunction(3)

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

πŸ’– NAME πŸ’–

rtcSetSceneProgressMonitorFunction β€” bestie, this one registers a callback so you can ~watch~ the build progress, like a little livestream but for your scene hierarchy πŸŽ€


✨ SYNOPSIS ✨

#include <embree3/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 iconic β€” you can use it to report how far along a hierarchy build operation is, and to cancel a build operation mid-swing. Main character energy, honestly. πŸ’…

rtcSetSceneProgressMonitorFunction is the one that registers your progress monitor callback function (that's the progress argument, bestie) along with its payload (the userPtr argument) for whichever scene you point at (the scene argument). Very demure, very mindful.

🚨 Only ONE callback function per scene, okay?? Further invocations just overwrite whatever callback was set before β€” no stacking, no hoarding. And if you pass NULL as the function pointer, that disables the registered callback function entirely. Poof. Gone. πŸ’€

Once it's registered, Embree will invoke your callback function multiple times during hierarchy build operations of the scene. Each time it hands over the payload you set at registration time (the userPtr argument) plus a double in the range [0, 1] that estimates the progress of the operation (the n argument). So like… 0 is "we just started bestie" and 1 is "we ate". πŸ”₯

😭 Heads up though: the callback function might be called from multiple threads concurrently. So keep your callback thread-safe, no cap.

Now for the return value tea β˜• β€” when you return true from the callback function, Embree keeps the build operation going like normal. When you return false, Embree cancels the build operation with the RTC_ERROR_CANCELLED error code. And yes, issuing multiple cancel requests for the same build operation is allowed β€” go off, cancel away. 🫢


🌸 EXIT STATUS 🌸

On failure an error code is set, and you can go query it with rtcGetDeviceError. Slay. ✨


🌈 SEE ALSO 🌈

  • [rtcNewScene]

That's the whole vibe, bestie β€” this is page rtcSetSce...rFunction(3) from the Embree Ray Tracing Kernels 3 manual set. Go forth and monitor that progress. Periodt. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from