.\" Automatically generated by Pandoc 2.5
.\"
.TH "rtcSetGeometryBoundsFunction" "3" "" "" "Embree Ray Tracing Kernels 3"
.hy
.SS NAME
.IP
.nf
\f[C]
rtcSetGeometryBoundsFunction \- sets a callback to query the
  bounding box of user\-defined primitives
\f[R]
.fi
.SS SYNOPSIS
.IP
.nf
\f[C]
#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
);
\f[R]
.fi
.SS DESCRIPTION
.PP
The \f[C]rtcSetGeometryBoundsFunction\f[R] function registers a bounding
box callback function (\f[C]bounds\f[R] argument) with payload
(\f[C]userPtr\f[R] argument) for the specified user geometry
(\f[C]geometry\f[R] argument).
.PP
Only a single callback function can be registered per geometry, and
further invocations overwrite the previously set callback function.
Passing \f[C]NULL\f[R] as function pointer disables the registered
callback function.
.PP
The registered bounding box callback function is 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 \f[C]RTCBoundsFunction\f[R] type is invoked
with a pointer to a structure of type
\f[C]RTCBoundsFunctionArguments\f[R] which contains various arguments,
such as: the user data of the geometry (\f[C]geometryUserPtr\f[R]
member), the ID of the primitive to calculate the bounds for
(\f[C]primID\f[R] member), the time step at which to calculate the
bounds (\f[C]timeStep\f[R] member), and a memory location to write the
calculated bound to (\f[C]bounds_o\f[R] member).
.PP
In a typical usage scenario one would store a pointer to the internal
representation of the user geometry object using
\f[C]rtcSetGeometryUserData\f[R].
The callback function can then read that pointer from the
\f[C]geometryUserPtr\f[R] field and calculate the proper bounding box
for the requested primitive and time, and store that bounding box to the
destination structure (\f[C]bounds_o\f[R] member).
.SS EXIT STATUS
.PP
On failure an error code is set that can be queried using
\f[C]rtcGetDeviceError\f[R].
.SS SEE ALSO
.PP
[RTC_GEOMETRY_TYPE_USER]
