rtcSetGeometryBoundsFunction.3embree3 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .TH "rtcSetGeometryBoundsFunction" "3" "" "" "Embree Ray Tracing Kernels 3"
  2. .SS NAME
  3. .IP
  4. .nf
  5. \f[C]
  6. rtcSetGeometryBoundsFunction\ \-\ sets\ a\ callback\ to\ query\ the
  7. \ \ bounding\ box\ of\ user\-defined\ primitives
  8. \f[]
  9. .fi
  10. .SS SYNOPSIS
  11. .IP
  12. .nf
  13. \f[C]
  14. #include\ <embree3/rtcore.h>
  15. struct\ RTCBoundsFunctionArguments
  16. {
  17. \ \ void*\ geometryUserPtr;
  18. \ \ unsigned\ int\ primID;
  19. \ \ unsigned\ int\ timeStep;
  20. \ \ struct\ RTCBounds*\ bounds_o;
  21. };
  22. typedef\ void\ (*RTCBoundsFunction)(
  23. \ \ const\ struct\ RTCBoundsFunctionArguments*\ args
  24. );
  25. void\ rtcSetGeometryBoundsFunction(
  26. \ \ RTCGeometry\ geometry,
  27. \ \ RTCBoundsFunction\ bounds,
  28. \ \ void*\ userPtr
  29. );
  30. \f[]
  31. .fi
  32. .SS DESCRIPTION
  33. .PP
  34. The \f[C]rtcSetGeometryBoundsFunction\f[] function registers a bounding
  35. box callback function (\f[C]bounds\f[] argument) with payload
  36. (\f[C]userPtr\f[] argument) for the specified user geometry
  37. (\f[C]geometry\f[] argument).
  38. .PP
  39. Only a single callback function can be registered per geometry, and
  40. further invocations overwrite the previously set callback function.
  41. Passing \f[C]NULL\f[] as function pointer disables the registered
  42. callback function.
  43. .PP
  44. The registered bounding box callback function is invoked to calculate
  45. axis\-aligned bounding boxes of the primitives of the user\-defined
  46. geometry during spatial acceleration structure construction.
  47. The bounding box callback of \f[C]RTCBoundsFunction\f[] type is invoked
  48. with a pointer to a structure of type
  49. \f[C]RTCBoundsFunctionArguments\f[] which contains various arguments,
  50. such as: the user data of the geometry (\f[C]geometryUserPtr\f[]
  51. member), the ID of the primitive to calculate the bounds for
  52. (\f[C]primID\f[] member), the time step at which to calculate the bounds
  53. (\f[C]timeStep\f[] member), and a memory location to write the
  54. calculated bound to (\f[C]bounds_o\f[] member).
  55. .PP
  56. In a typical usage scenario one would store a pointer to the internal
  57. representation of the user geometry object using
  58. \f[C]rtcSetGeometryUserData\f[].
  59. The callback function can then read that pointer from the
  60. \f[C]geometryUserPtr\f[] field and calculate the proper bounding box for
  61. the requested primitive and time, and store that bounding box to the
  62. destination structure (\f[C]bounds_o\f[] member).
  63. .SS EXIT STATUS
  64. .PP
  65. On failure an error code is set that can be queried using
  66. \f[C]rtcGetDeviceError\f[].
  67. .SS SEE ALSO
  68. .PP
  69. [RTC_GEOMETRY_TYPE_USER]