1rtcSetGeometryIntersectFunEcmtbiroene(3R)ay Tracing KretrcnSeeltsGe3ometryIntersectFunction(3)
2
3
4
5   NAME
6              rtcSetGeometryIntersectFunction - sets the callback function to
7                intersect a user geometry
8
9   SYNOPSIS
10              #include <embree3/rtcore.h>
11
12              struct RTCIntersectFunctionNArguments
13              {
14                int* valid;
15                void* geometryUserPtr;
16                unsigned int primID;
17                struct RTCIntersectContext* context;
18                struct RTCRayHitN* rayhit;
19                unsigned int N;
20              };
21
22              typedef void (*RTCIntersectFunctionN)(
23                const struct RTCIntersectFunctionNArguments* args
24              );
25
26              void rtcSetGeometryIntersectFunction(
27                RTCGeometry geometry,
28                RTCIntersectFunctionN intersect
29              );
30
31   DESCRIPTION
32       The  rtcSetGeometryIntersectFunction function registers a ray/primitive
33       intersection callback function (intersect argument) for  the  specified
34       user geometry (geometry argument).
35
36       Only a single callback function can be registered per geometry and fur‐
37       ther invocations overwrite the previously set callback function.  Pass‐
38       ing NULL as function pointer disables the registered callback function.
39
40       The  registered  callback  function is invoked by rtcIntersect-type ray
41       queries to calculate the intersection of a ray packet of variable  size
42       with  one user-defined primitive.  The callback function of type RTCIn‐
43       tersectFunctionN gets passed a number of arguments through  the  RTCIn‐
44       tersectFunctionNArguments  structure.   The  value  N specifies the ray
45       packet size, valid points to an array of integers that specify  whether
46       the corresponding ray is valid (-1) or invalid (0), the geometryUserPtr
47       member points to the geometry user data previously set through  rtcSet‐
48       GeometryUserData, the context member points to the intersection context
49       passed to the ray query, the rayhit member points  to  a  ray  and  hit
50       packet  of variable size N, and the primID member identifies the primi‐
51       tive ID of the primitive to intersect.
52
53       The ray component of the rayhit structure contains valid data, in  par‐
54       ticular  the tfar value is the current closest hit distance found.  All
55       data inside the hit component of the rayhit structure are undefined and
56       should not be read by the function.
57
58       The  task of the callback function is to intersect each active ray from
59       the ray packet with the specified user primitive.  If the  user-defined
60       primitive  is  missed  by  a ray of the ray packet, the function should
61       return without modifying the ray or hit.  If  an  intersection  of  the
62       user-defined  primitive with the ray was found in the valid range (from
63       tnear to tfar), it should update the hit distance of the ray (tfar mem‐
64       ber)  and  the hit (u, v, Ng, instID, geomID, primID members).  In par‐
65       ticular, the currently intersected instance is  stored  in  the  instID
66       field of the intersection context, which must be copied into the instID
67       member of the hit.
68
69       As a primitive might have multiple intersections with a ray, the inter‐
70       section filter function needs to be invoked by the user geometry inter‐
71       section callback for each encountered  intersection,  if  filtering  of
72       intersections  is desired.  This can be achieved through the rtcFilter‐
73       Intersection call.
74
75       Within the user geometry intersect function, it is safe  to  trace  new
76       rays and create new scenes and geometries.
77
78   EXIT STATUS
79       On  failure  an  error  code is set that can be queried using rtcGetDe‐
80       viceError.
81
82   SEE ALSO
83       [rtcSetGeometryOccludedFunction], [rtcSetGeometryUserData], [rtcFilter‐
84       Intersection]
85
86
87
88                                            rtcSetGeometryIntersectFunction(3)
Impressum