.TH "rtcAttachGeometry" "3" "" "" "Embree Ray Tracing Kernels 3"
.SS NAME
.IP
.nf
\f[C]
rtcAttachGeometry\ \-\ attaches\ a\ geometry\ to\ the\ scene
\f[]
.fi
.SS SYNOPSIS
.IP
.nf
\f[C]
#include\ <embree3/rtcore.h>

unsigned\ int\ rtcAttachGeometry(
\ \ RTCScene\ scene,
\ \ RTCGeometry\ geometry
);
\f[]
.fi
.SS DESCRIPTION
.PP
The \f[C]rtcAttachGeometry\f[] function attaches a geometry
(\f[C]geometry\f[] argument) to a scene (\f[C]scene\f[] argument) and
assigns a geometry ID to that geometry.
All geometries attached to a scene are defined to be included inside the
scene.
A geometry can only get attached to a single scene at a given time.
However, it is possible to detach and re\-attach a geometry to a
different scene.
The geometry ID is unique for the scene, and is used to identify the
geometry when hit by a ray during ray queries.
.PP
This function is thread\-safe, thus multiple threads can attach
geometries to a scene in parallel.
.PP
The geometry IDs are assigned sequentially, starting from 0, as long as
no geometry got detached.
If geometries got detached, the implementation will reuse IDs in an
implementation dependent way.
Consequently sequential assignment is no longer guaranteed, but a
compact range of IDs.
.PP
These rules allow the application to manage a dynamic array to
efficiently map from geometry IDs to its own geometry representation.
Alternatively, the application can also use per\-geometry user data to
map to its geometry representation.
See \f[C]rtcSetGeometryUserData\f[] and \f[C]rtcGetGeometryUserData\f[]
for more information.
.SS EXIT STATUS
.PP
On failure an error code is set that can be queried using
\f[C]rtcGetDeviceError\f[].
.SS SEE ALSO
.PP
[rtcSetGeometryUserData], [rtcGetGeometryUserData]
